[gradle-debian-helper] 02/04: Fixed the line endings (CRLF -> LF)
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Fri Oct 16 13:43:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository gradle-debian-helper.
commit 7e4ba8b940ecc58c49c43991e6e4d49b88b2cadd
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Fri Oct 16 15:34:16 2015 +0200
Fixed the line endings (CRLF -> LF)
---
LICENSE.txt | 404 ++++++++++-----------
README.txt | 76 ++--
TODO.txt | 10 +-
.../java/org/debian/gradle/DebianHelperPlugin.java | 98 ++---
.../debian/gradle/DebianTemporaryFileProvider.java | 80 ++--
.../java/org/debian/gradle/KeepAliveTimer.java | 98 ++---
.../gradle/MavenDebianArtifactRepository.java | 358 +++++++++---------
gradle-helper-plugin/src/main/perl/gradle.pm | 118 +++---
test-project/build.gradle | 50 +--
test-project/buildSrc/build.gradle | 10 +-
test-project/debian/maven.ignoreRules | 4 +-
test-project/debian/maven.rules | 6 +-
test-project/init.gradle | 18 +-
test-project/settings.gradle | 10 +-
test-project/src/main/java/HelloWorld.java | 14 +-
.../project1/src/main/java/Project1.java | 6 +-
.../project2/src/main/java/Project2.java | 6 +-
17 files changed, 683 insertions(+), 683 deletions(-)
diff --git a/LICENSE.txt b/LICENSE.txt
index 75b5248..d645695 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,202 +1,202 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.txt b/README.txt
index 12671d5..3ab39f2 100644
--- a/README.txt
+++ b/README.txt
@@ -1,38 +1,38 @@
-Gradle Debian Helper
---------------------
-
-This project contains helper tools to ease the packaging of Gradle based projects in Debian.
-It consists in:
- * a Gradle plugin resolving the dependencies against the system Maven repository (/usr/share/maven-repo).
- The resolver uses the same Maven rule files that maven-debian-helper and maven-repo-helper employ
- (debian/maven.rules, debian/maven.ignoreRules).
- * a build listener displaying a message periodically to prevent the builders from killing Gradle on slow architectures.
- * a debhelper class detecting Gradle build files, initializing the plugin and running Gradle in offline mode.
-
-
-Usage
------
-
-1. Add a build dependency on gradle-debian-helper in debian/control
-
-2. Use a debian/rules file with:
-
- %:
- dh $@ --buildsystem=gradle
-
-3. Create debian/maven.rules and/or debian.maven.ignoreRules with the dependency rules
-
-4. For building only some subprojects and ignoring the other,
- pass Gradle parameters to dh_auto_build:
-
- override_dh_auto_build:
- dh_auto_build -- :project1:jar :project2:jar
-
-
-Limitations
------------
-
-* Dependencies with a version range are not handled (e.g. org.foo:bar:1.0+)
-* Transitive dependencies with a non generic version (neither 'debian' nor '.x')
- must be added to debian/maven.rules in order to preserve the version
- (with a rule like: org.foo bar * * * *)
+Gradle Debian Helper
+--------------------
+
+This project contains helper tools to ease the packaging of Gradle based projects in Debian.
+It consists in:
+ * a Gradle plugin resolving the dependencies against the system Maven repository (/usr/share/maven-repo).
+ The resolver uses the same Maven rule files that maven-debian-helper and maven-repo-helper employ
+ (debian/maven.rules, debian/maven.ignoreRules).
+ * a build listener displaying a message periodically to prevent the builders from killing Gradle on slow architectures.
+ * a debhelper class detecting Gradle build files, initializing the plugin and running Gradle in offline mode.
+
+
+Usage
+-----
+
+1. Add a build dependency on gradle-debian-helper in debian/control
+
+2. Use a debian/rules file with:
+
+ %:
+ dh $@ --buildsystem=gradle
+
+3. Create debian/maven.rules and/or debian.maven.ignoreRules with the dependency rules
+
+4. For building only some subprojects and ignoring the other,
+ pass Gradle parameters to dh_auto_build:
+
+ override_dh_auto_build:
+ dh_auto_build -- :project1:jar :project2:jar
+
+
+Limitations
+-----------
+
+* Dependencies with a version range are not handled (e.g. org.foo:bar:1.0+)
+* Transitive dependencies with a non generic version (neither 'debian' nor '.x')
+ must be added to debian/maven.rules in order to preserve the version
+ (with a rule like: org.foo bar * * * *)
diff --git a/TODO.txt b/TODO.txt
index d8aa6a1..8ee2df5 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,5 +1,5 @@
-TODO
-----
-
-- Handle version ranges
-- Ignore the transitive dependencies
+TODO
+----
+
+- Handle version ranges
+- Ignore the transitive dependencies
diff --git a/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianHelperPlugin.java b/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianHelperPlugin.java
index 9531a0d..0a2b6f6 100644
--- a/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianHelperPlugin.java
+++ b/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianHelperPlugin.java
@@ -1,49 +1,49 @@
-/**
- * Copyright 2015 Emmanuel Bourg
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.debian.gradle;
-
-import org.gradle.api.Action;
-import org.gradle.api.Plugin;
-import org.gradle.api.Project;
-import org.gradle.api.invocation.Gradle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Gradle plugin installing the Debian repository before those defined in the build script.
- */
-public class DebianHelperPlugin implements Plugin<Gradle> {
-
- private final Logger log = LoggerFactory.getLogger(DebianHelperPlugin.class);
-
- @Override
- public void apply(Gradle gradle) {
- // add the Debian repository to all projects
- final MavenDebianArtifactRepository repository = new MavenDebianArtifactRepository();
- gradle.allprojects(new Action<Project>() {
- @Override
- public void execute(final Project project) {
- log.info("\tAdding Debian repository to project '" + project.getName() + "'");
- project.getRepositories().addFirst(repository);
- project.getBuildscript().getRepositories().addFirst(repository);
- }
- });
-
- // start a timer displaying a message periodically to prevent the builders from killing Gradle on slow architectures
- gradle.addBuildListener(new KeepAliveTimer());
- }
-}
+/**
+ * Copyright 2015 Emmanuel Bourg
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.gradle;
+
+import org.gradle.api.Action;
+import org.gradle.api.Plugin;
+import org.gradle.api.Project;
+import org.gradle.api.invocation.Gradle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Gradle plugin installing the Debian repository before those defined in the build script.
+ */
+public class DebianHelperPlugin implements Plugin<Gradle> {
+
+ private final Logger log = LoggerFactory.getLogger(DebianHelperPlugin.class);
+
+ @Override
+ public void apply(Gradle gradle) {
+ // add the Debian repository to all projects
+ final MavenDebianArtifactRepository repository = new MavenDebianArtifactRepository();
+ gradle.allprojects(new Action<Project>() {
+ @Override
+ public void execute(final Project project) {
+ log.info("\tAdding Debian repository to project '" + project.getName() + "'");
+ project.getRepositories().addFirst(repository);
+ project.getBuildscript().getRepositories().addFirst(repository);
+ }
+ });
+
+ // start a timer displaying a message periodically to prevent the builders from killing Gradle on slow architectures
+ gradle.addBuildListener(new KeepAliveTimer());
+ }
+}
diff --git a/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianTemporaryFileProvider.java b/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianTemporaryFileProvider.java
index a26b002..076c184 100644
--- a/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianTemporaryFileProvider.java
+++ b/gradle-helper-plugin/src/main/java/org/debian/gradle/DebianTemporaryFileProvider.java
@@ -1,40 +1,40 @@
-/**
- * Copyright 2015 Emmanuel Bourg
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.debian.gradle;
-
-import java.io.File;
-
-import org.gradle.api.internal.file.DefaultTemporaryFileProvider;
-import org.gradle.internal.Factory;
-
-/**
- * Create temporary directories into the local .gradle directory using during the Debian build.
- */
-class DebianTemporaryFileProvider extends DefaultTemporaryFileProvider {
-
- public DebianTemporaryFileProvider() {
- super(new Factory<File>() {
- @Override
- public File create() {
- File directory = new File(".gradle/tmp/");
- directory.mkdirs();
- return directory;
- }
-
- });
- }
-}
+/**
+ * Copyright 2015 Emmanuel Bourg
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.gradle;
+
+import java.io.File;
+
+import org.gradle.api.internal.file.DefaultTemporaryFileProvider;
+import org.gradle.internal.Factory;
+
+/**
+ * Create temporary directories into the local .gradle directory using during the Debian build.
+ */
+class DebianTemporaryFileProvider extends DefaultTemporaryFileProvider {
+
+ public DebianTemporaryFileProvider() {
+ super(new Factory<File>() {
+ @Override
+ public File create() {
+ File directory = new File(".gradle/tmp/");
+ directory.mkdirs();
+ return directory;
+ }
+
+ });
+ }
+}
diff --git a/gradle-helper-plugin/src/main/java/org/debian/gradle/KeepAliveTimer.java b/gradle-helper-plugin/src/main/java/org/debian/gradle/KeepAliveTimer.java
index fa79180..d0fdefc 100644
--- a/gradle-helper-plugin/src/main/java/org/debian/gradle/KeepAliveTimer.java
+++ b/gradle-helper-plugin/src/main/java/org/debian/gradle/KeepAliveTimer.java
@@ -1,49 +1,49 @@
-/**
- * Copyright 2015 Emmanuel Bourg
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.debian.gradle;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.gradle.BuildAdapter;
-import org.gradle.api.invocation.Gradle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Build listener displaying a message every 10 minutes. This prevents the auto builders
- * from killing Gradle on slow architectures.
- */
-class KeepAliveTimer extends BuildAdapter {
-
- private final Logger log = LoggerFactory.getLogger(KeepAliveTimer.class);
-
- private static final long PERIOD = 10 * 60 * 1000L; // 10 minutes
-
- @Override
- public void projectsLoaded(Gradle gradle) {
- Timer timer = new Timer("Gradle Keep-alive Timer", true);
- timer.schedule(new TimerTask() {
- @Override
- public void run() {
- log.info("\tGradle is still running, please be patient...");
- }
- }, PERIOD, PERIOD);
-
- log.info("\tKeep-alive timer started");
- }
-}
+/**
+ * Copyright 2015 Emmanuel Bourg
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.gradle;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.gradle.BuildAdapter;
+import org.gradle.api.invocation.Gradle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Build listener displaying a message every 10 minutes. This prevents the auto builders
+ * from killing Gradle on slow architectures.
+ */
+class KeepAliveTimer extends BuildAdapter {
+
+ private final Logger log = LoggerFactory.getLogger(KeepAliveTimer.class);
+
+ private static final long PERIOD = 10 * 60 * 1000L; // 10 minutes
+
+ @Override
+ public void projectsLoaded(Gradle gradle) {
+ Timer timer = new Timer("Gradle Keep-alive Timer", true);
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ log.info("\tGradle is still running, please be patient...");
+ }
+ }, PERIOD, PERIOD);
+
+ log.info("\tKeep-alive timer started");
+ }
+}
diff --git a/gradle-helper-plugin/src/main/java/org/debian/gradle/MavenDebianArtifactRepository.java b/gradle-helper-plugin/src/main/java/org/debian/gradle/MavenDebianArtifactRepository.java
index de5de79..2f8d8cf 100644
--- a/gradle-helper-plugin/src/main/java/org/debian/gradle/MavenDebianArtifactRepository.java
+++ b/gradle-helper-plugin/src/main/java/org/debian/gradle/MavenDebianArtifactRepository.java
@@ -1,179 +1,179 @@
-/**
- * Copyright 2015 Emmanuel Bourg
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.debian.gradle;
-
-import java.io.File;
-
-import org.debian.maven.cliargs.ArgumentsIterable;
-import org.debian.maven.cliargs.ArgumentsMap;
-import org.debian.maven.repo.Dependency;
-import org.debian.maven.repo.DependencyRule;
-import org.debian.maven.repo.DependencyRuleSetFiles;
-import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ConfiguredModuleComponentRepository;
-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser;
-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser;
-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionComparator;
-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionSelectorScheme;
-import org.gradle.api.internal.artifacts.repositories.AbstractArtifactRepository;
-import org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository;
-import org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver;
-import org.gradle.api.internal.filestore.ivy.ArtifactIdentifierFileStore;
-import org.gradle.internal.component.external.model.DefaultMavenModuleResolveMetaData;
-import org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier;
-import org.gradle.internal.component.external.model.ModuleComponentArtifactMetaData;
-import org.gradle.internal.component.model.ComponentOverrideMetadata;
-import org.gradle.internal.component.model.DefaultComponentOverrideMetadata;
-import org.gradle.internal.component.model.DefaultIvyArtifactName;
-import org.gradle.internal.component.model.IvyArtifactName;
-import org.gradle.internal.resolve.result.BuildableModuleComponentMetaDataResolveResult;
-import org.gradle.internal.resource.local.LocallyAvailableResourceFinder;
-import org.gradle.internal.resource.local.LocallyAvailableResourceFinderSearchableFileStoreAdapter;
-import org.gradle.internal.resource.local.PathKeyFileStore;
-import org.gradle.internal.resource.transport.file.FileTransport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Artifact repository resolving the dependencies against the system repository under /usr/share/maven-repo.
- */
-public class MavenDebianArtifactRepository extends AbstractArtifactRepository implements ResolutionAwareRepository {
-
- private final Logger log = LoggerFactory.getLogger(MavenDebianArtifactRepository.class);
-
- private final LocallyAvailableResourceFinder<ModuleComponentArtifactMetaData> locallyAvailableResourceFinder;
- private final ArtifactIdentifierFileStore artifactFileStore;
- private final MetaDataParser<DefaultMavenModuleResolveMetaData> pomParser;
-
- /** The substitution rules for the Maven dependencies */
- private DependencyRuleSetFiles rulesets;
-
- /** The path to the local Maven repository */
- private File repositoryPath = new File("/usr/share/maven-repo");
-
- /** The placeholder used for ignored dependencies */
- private static final ModuleComponentIdentifier IGNORED_DEPENDENCY_PLACEHOLDER = new DefaultModuleComponentIdentifier("org.debian.gradle", "gradle-dependency-placeholder", "1.0");
-
- public MavenDebianArtifactRepository() {
- this.pomParser = new GradlePomModuleDescriptorParser(new DefaultVersionSelectorScheme(new DefaultVersionComparator()));
- this.artifactFileStore = new ArtifactIdentifierFileStore(new PathKeyFileStore(repositoryPath), new DebianTemporaryFileProvider());
- this.locallyAvailableResourceFinder = new LocallyAvailableResourceFinderSearchableFileStoreAdapter<>(artifactFileStore);
-
- log.info("\tLoading the Maven rules...");
- ArgumentsMap args = new ArgumentsMap(new ArgumentsIterable(new String[] { "--rules=debian/maven.rules", "--ignore-rules=debian/maven.ignoreRules"}));
- rulesets = DependencyRuleSetFiles.fromCLIArguments(args, false);
- rulesets.addDefaultRules();
- }
-
- @Override
- public String getName() {
- return "Debian Maven Repository";
- }
-
- public ConfiguredModuleComponentRepository createResolver() {
- return new MavenResolver(getName(), repositoryPath.toURI(), new FileTransport("debian"), locallyAvailableResourceFinder, artifactFileStore, pomParser) {
-
- @Override
- protected void doResolveComponentMetaData(ModuleComponentIdentifier identifier, ComponentOverrideMetadata metadata, BuildableModuleComponentMetaDataResolveResult result) {
- Dependency dependency = toDependency(identifier, metadata);
- Dependency resolved = resolve(dependency);
-
- if (resolved == null) {
- log.info("\tIgnoring " + format(dependency));
- identifier = IGNORED_DEPENDENCY_PLACEHOLDER;
-
- } else if (dependency == resolved) {
- log.info("\tPassing though " + format(dependency));
- } else {
- log.info("\tReplacing " + format(dependency) + " -> " + format(resolved));
- identifier = new DefaultModuleComponentIdentifier(resolved.getGroupId(), resolved.getArtifactId(), resolved.getVersion());
- metadata = new DefaultComponentOverrideMetadata();
- metadata.getArtifacts().add(new DefaultIvyArtifactName(resolved.getArtifactId(), resolved.getType(), resolved.getType(), resolved.getClassifier()));
- }
-
- super.doResolveComponentMetaData(identifier, metadata, result);
- }
- };
- }
-
- /**
- * Apply the Maven rules to the specified dependency.
- *
- * @param dependency the resolved dependency, or null if the dependency is ignored.
- */
- private Dependency resolve(Dependency dependency) {
- // check if the dependency is ignored
- for (DependencyRule rule : rulesets.get(DependencyRuleSetFiles.RulesType.IGNORE).getRules()) {
- if (rule.matches(dependency)) {
- return null;
- }
- }
-
- /**
- * The transitive dependencies are also resolved but unfortunately there is no way to detect them as such.
- * This means that a transitive dependency on asm:4.x for example would be transformed into asm:debian unless
- * its rule is copied into debian/maven.rules in order to preserve the generic '4.x' version. To mitigate this
- * issue the '.x' generic versions are detected and passed through. Artifacts with no generic version are still
- * affected though, and their rules have to be added to debian/maven.rules.
- */
- if (!dependency.getVersion().endsWith(".x") && !dependency.getVersion().equals("debian")) {
- // apply the first rule that matches
- for (DependencyRule rule : rulesets.get(DependencyRuleSetFiles.RulesType.RULES).getRules()) {
- if (rule.matches(dependency)) {
- return rule.apply(dependency);
- }
- }
- }
-
- return dependency;
- }
-
- /**
- * Converts a Gradle dependency into a dependency object as handled by maven-repo-helper.
- */
- private Dependency toDependency(ModuleComponentIdentifier identifier, ComponentOverrideMetadata metadata) {
- String classifier = null;
- String type = "jar";
- if (!metadata.getArtifacts().isEmpty()) {
- IvyArtifactName ivyArtifactName = metadata.getArtifacts().iterator().next();
- classifier = ivyArtifactName.getClassifier();
- type = ivyArtifactName.getType();
- }
-
- return new Dependency(identifier.getGroup(), identifier.getModule(), type, identifier.getVersion(), "compile", false, classifier, null);
- }
-
- /**
- * Format a dependency for display (slightly more compact than dependency.toString())
- */
- private String format(Dependency dependency) {
- StringBuilder builder = new StringBuilder();
- builder.append(dependency.getGroupId());
- builder.append(":");
- builder.append(dependency.getArtifactId());
- builder.append(":");
- builder.append(dependency.getType());
- builder.append(":");
- builder.append(dependency.getVersion());
- if (dependency.getClassifier() != null && dependency.getClassifier().trim().length() > 0) {
- builder.append(":");
- builder.append(dependency.getClassifier());
- }
-
- return builder.toString();
- }
-}
+/**
+ * Copyright 2015 Emmanuel Bourg
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.gradle;
+
+import java.io.File;
+
+import org.debian.maven.cliargs.ArgumentsIterable;
+import org.debian.maven.cliargs.ArgumentsMap;
+import org.debian.maven.repo.Dependency;
+import org.debian.maven.repo.DependencyRule;
+import org.debian.maven.repo.DependencyRuleSetFiles;
+import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
+import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ConfiguredModuleComponentRepository;
+import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser;
+import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser;
+import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionComparator;
+import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionSelectorScheme;
+import org.gradle.api.internal.artifacts.repositories.AbstractArtifactRepository;
+import org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository;
+import org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver;
+import org.gradle.api.internal.filestore.ivy.ArtifactIdentifierFileStore;
+import org.gradle.internal.component.external.model.DefaultMavenModuleResolveMetaData;
+import org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier;
+import org.gradle.internal.component.external.model.ModuleComponentArtifactMetaData;
+import org.gradle.internal.component.model.ComponentOverrideMetadata;
+import org.gradle.internal.component.model.DefaultComponentOverrideMetadata;
+import org.gradle.internal.component.model.DefaultIvyArtifactName;
+import org.gradle.internal.component.model.IvyArtifactName;
+import org.gradle.internal.resolve.result.BuildableModuleComponentMetaDataResolveResult;
+import org.gradle.internal.resource.local.LocallyAvailableResourceFinder;
+import org.gradle.internal.resource.local.LocallyAvailableResourceFinderSearchableFileStoreAdapter;
+import org.gradle.internal.resource.local.PathKeyFileStore;
+import org.gradle.internal.resource.transport.file.FileTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Artifact repository resolving the dependencies against the system repository under /usr/share/maven-repo.
+ */
+public class MavenDebianArtifactRepository extends AbstractArtifactRepository implements ResolutionAwareRepository {
+
+ private final Logger log = LoggerFactory.getLogger(MavenDebianArtifactRepository.class);
+
+ private final LocallyAvailableResourceFinder<ModuleComponentArtifactMetaData> locallyAvailableResourceFinder;
+ private final ArtifactIdentifierFileStore artifactFileStore;
+ private final MetaDataParser<DefaultMavenModuleResolveMetaData> pomParser;
+
+ /** The substitution rules for the Maven dependencies */
+ private DependencyRuleSetFiles rulesets;
+
+ /** The path to the local Maven repository */
+ private File repositoryPath = new File("/usr/share/maven-repo");
+
+ /** The placeholder used for ignored dependencies */
+ private static final ModuleComponentIdentifier IGNORED_DEPENDENCY_PLACEHOLDER = new DefaultModuleComponentIdentifier("org.debian.gradle", "gradle-dependency-placeholder", "1.0");
+
+ public MavenDebianArtifactRepository() {
+ this.pomParser = new GradlePomModuleDescriptorParser(new DefaultVersionSelectorScheme(new DefaultVersionComparator()));
+ this.artifactFileStore = new ArtifactIdentifierFileStore(new PathKeyFileStore(repositoryPath), new DebianTemporaryFileProvider());
+ this.locallyAvailableResourceFinder = new LocallyAvailableResourceFinderSearchableFileStoreAdapter<>(artifactFileStore);
+
+ log.info("\tLoading the Maven rules...");
+ ArgumentsMap args = new ArgumentsMap(new ArgumentsIterable(new String[] { "--rules=debian/maven.rules", "--ignore-rules=debian/maven.ignoreRules"}));
+ rulesets = DependencyRuleSetFiles.fromCLIArguments(args, false);
+ rulesets.addDefaultRules();
+ }
+
+ @Override
+ public String getName() {
+ return "Debian Maven Repository";
+ }
+
+ public ConfiguredModuleComponentRepository createResolver() {
+ return new MavenResolver(getName(), repositoryPath.toURI(), new FileTransport("debian"), locallyAvailableResourceFinder, artifactFileStore, pomParser) {
+
+ @Override
+ protected void doResolveComponentMetaData(ModuleComponentIdentifier identifier, ComponentOverrideMetadata metadata, BuildableModuleComponentMetaDataResolveResult result) {
+ Dependency dependency = toDependency(identifier, metadata);
+ Dependency resolved = resolve(dependency);
+
+ if (resolved == null) {
+ log.info("\tIgnoring " + format(dependency));
+ identifier = IGNORED_DEPENDENCY_PLACEHOLDER;
+
+ } else if (dependency == resolved) {
+ log.info("\tPassing though " + format(dependency));
+ } else {
+ log.info("\tReplacing " + format(dependency) + " -> " + format(resolved));
+ identifier = new DefaultModuleComponentIdentifier(resolved.getGroupId(), resolved.getArtifactId(), resolved.getVersion());
+ metadata = new DefaultComponentOverrideMetadata();
+ metadata.getArtifacts().add(new DefaultIvyArtifactName(resolved.getArtifactId(), resolved.getType(), resolved.getType(), resolved.getClassifier()));
+ }
+
+ super.doResolveComponentMetaData(identifier, metadata, result);
+ }
+ };
+ }
+
+ /**
+ * Apply the Maven rules to the specified dependency.
+ *
+ * @param dependency the resolved dependency, or null if the dependency is ignored.
+ */
+ private Dependency resolve(Dependency dependency) {
+ // check if the dependency is ignored
+ for (DependencyRule rule : rulesets.get(DependencyRuleSetFiles.RulesType.IGNORE).getRules()) {
+ if (rule.matches(dependency)) {
+ return null;
+ }
+ }
+
+ /**
+ * The transitive dependencies are also resolved but unfortunately there is no way to detect them as such.
+ * This means that a transitive dependency on asm:4.x for example would be transformed into asm:debian unless
+ * its rule is copied into debian/maven.rules in order to preserve the generic '4.x' version. To mitigate this
+ * issue the '.x' generic versions are detected and passed through. Artifacts with no generic version are still
+ * affected though, and their rules have to be added to debian/maven.rules.
+ */
+ if (!dependency.getVersion().endsWith(".x") && !dependency.getVersion().equals("debian")) {
+ // apply the first rule that matches
+ for (DependencyRule rule : rulesets.get(DependencyRuleSetFiles.RulesType.RULES).getRules()) {
+ if (rule.matches(dependency)) {
+ return rule.apply(dependency);
+ }
+ }
+ }
+
+ return dependency;
+ }
+
+ /**
+ * Converts a Gradle dependency into a dependency object as handled by maven-repo-helper.
+ */
+ private Dependency toDependency(ModuleComponentIdentifier identifier, ComponentOverrideMetadata metadata) {
+ String classifier = null;
+ String type = "jar";
+ if (!metadata.getArtifacts().isEmpty()) {
+ IvyArtifactName ivyArtifactName = metadata.getArtifacts().iterator().next();
+ classifier = ivyArtifactName.getClassifier();
+ type = ivyArtifactName.getType();
+ }
+
+ return new Dependency(identifier.getGroup(), identifier.getModule(), type, identifier.getVersion(), "compile", false, classifier, null);
+ }
+
+ /**
+ * Format a dependency for display (slightly more compact than dependency.toString())
+ */
+ private String format(Dependency dependency) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(dependency.getGroupId());
+ builder.append(":");
+ builder.append(dependency.getArtifactId());
+ builder.append(":");
+ builder.append(dependency.getType());
+ builder.append(":");
+ builder.append(dependency.getVersion());
+ if (dependency.getClassifier() != null && dependency.getClassifier().trim().length() > 0) {
+ builder.append(":");
+ builder.append(dependency.getClassifier());
+ }
+
+ return builder.toString();
+ }
+}
diff --git a/gradle-helper-plugin/src/main/perl/gradle.pm b/gradle-helper-plugin/src/main/perl/gradle.pm
index 985e5b7..92edaaf 100644
--- a/gradle-helper-plugin/src/main/perl/gradle.pm
+++ b/gradle-helper-plugin/src/main/perl/gradle.pm
@@ -1,59 +1,59 @@
-# A debhelper build system class for handling Gradle based projects.
-#
-# Copyright: 2015, Emmanuel Bourg
-# License: Apache-2.0
-
-package Debian::Debhelper::Buildsystem::gradle;
-
-use strict;
-use base 'Debian::Debhelper::Buildsystem';
-
-sub DESCRIPTION {
- "Gradle (build.gradle)"
-}
-
-sub check_auto_buildable {
- my $this=shift;
- return (-e $this->get_sourcepath("build.gradle")) ? 1 : 0;
-}
-
-sub new {
- my $class=shift;
- my $this=$class->SUPER::new(@_);
-
- @{$this->{gradle_cmd}} = ("gradle",
- "--info",
- "--console", "plain",
- "--offline",
- "--stacktrace",
- "--no-daemon",
- "--refresh-dependencies",
- "--gradle-user-home", ".gradle",
- # "--init-script", "/usr/share/gradle-debian-helper/init.gradle",
- );
-
- return $this;
-}
-
-sub build {
- my $this=shift;
-
- # Copy the init script under .gradle/init.d to work around a bug with the --init-script parameter (GRADLE-3197)
- $this->doit_in_builddir("mkdir", "-p", ".gradle/init.d");
- $this->doit_in_builddir("cp", "/usr/share/gradle-debian-helper/init.gradle", ".gradle/init.d/");
-
- if (!@_) {
- push(@_, "jar");
- }
-
- $this->doit_in_builddir(@{$this->{gradle_cmd}}, @_);
-}
-
-sub clean {
- my $this=shift;
-
- $this->doit_in_builddir("find . -wholename .*build/tmp | xargs echo | sed -e 's^build/tmp^build^g' | xargs rm -Rf");
- $this->doit_in_builddir("rm", "-Rf", "$this->{cwd}/.gradle", "$this->{cwd}/buildSrc/.gradle");
-}
-
-1
+# A debhelper build system class for handling Gradle based projects.
+#
+# Copyright: 2015, Emmanuel Bourg
+# License: Apache-2.0
+
+package Debian::Debhelper::Buildsystem::gradle;
+
+use strict;
+use base 'Debian::Debhelper::Buildsystem';
+
+sub DESCRIPTION {
+ "Gradle (build.gradle)"
+}
+
+sub check_auto_buildable {
+ my $this=shift;
+ return (-e $this->get_sourcepath("build.gradle")) ? 1 : 0;
+}
+
+sub new {
+ my $class=shift;
+ my $this=$class->SUPER::new(@_);
+
+ @{$this->{gradle_cmd}} = ("gradle",
+ "--info",
+ "--console", "plain",
+ "--offline",
+ "--stacktrace",
+ "--no-daemon",
+ "--refresh-dependencies",
+ "--gradle-user-home", ".gradle",
+ # "--init-script", "/usr/share/gradle-debian-helper/init.gradle",
+ );
+
+ return $this;
+}
+
+sub build {
+ my $this=shift;
+
+ # Copy the init script under .gradle/init.d to work around a bug with the --init-script parameter (GRADLE-3197)
+ $this->doit_in_builddir("mkdir", "-p", ".gradle/init.d");
+ $this->doit_in_builddir("cp", "/usr/share/gradle-debian-helper/init.gradle", ".gradle/init.d/");
+
+ if (!@_) {
+ push(@_, "jar");
+ }
+
+ $this->doit_in_builddir(@{$this->{gradle_cmd}}, @_);
+}
+
+sub clean {
+ my $this=shift;
+
+ $this->doit_in_builddir("find . -wholename .*build/tmp | xargs echo | sed -e 's^build/tmp^build^g' | xargs rm -Rf");
+ $this->doit_in_builddir("rm", "-Rf", "$this->{cwd}/.gradle", "$this->{cwd}/buildSrc/.gradle");
+}
+
+1
diff --git a/test-project/build.gradle b/test-project/build.gradle
index 9291a96..27fedc8 100644
--- a/test-project/build.gradle
+++ b/test-project/build.gradle
@@ -1,25 +1,25 @@
-allprojects {
- apply plugin: 'java'
-}
-
-dependencies {
- compile group: 'commons-collections', name: 'commons-collections', version: 'debian'
- compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
-}
-
-project(':project1') {
- dependencies {
- compile group: 'commons-io', name: 'commons-io', version: '2.6'
- compile group: 'junit', name: 'junit', version: '4.11'
- compile group: 'cglib', name: 'cglib', version: '3.1'
- // todo compile "org.foo:bar:1.0+:native"
- }
-}
-
-project(':project2') {
- dependencies {
- compile group: 'commons-compress', name: 'commons-compress', version: '1.8'
- compile group: 'org.hsqldb', name: 'hsqldb', version: '2.3.3', classifier: 'jdk5'
- compile group: 'org.apache.ant', name: 'ant', version: '1.9.6'
- }
-}
+allprojects {
+ apply plugin: 'java'
+}
+
+dependencies {
+ compile group: 'commons-collections', name: 'commons-collections', version: 'debian'
+ compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
+}
+
+project(':project1') {
+ dependencies {
+ compile group: 'commons-io', name: 'commons-io', version: '2.6'
+ compile group: 'junit', name: 'junit', version: '4.11'
+ compile group: 'cglib', name: 'cglib', version: '3.1'
+ // todo compile "org.foo:bar:1.0+:native"
+ }
+}
+
+project(':project2') {
+ dependencies {
+ compile group: 'commons-compress', name: 'commons-compress', version: '1.8'
+ compile group: 'org.hsqldb', name: 'hsqldb', version: '2.3.3', classifier: 'jdk5'
+ compile group: 'org.apache.ant', name: 'ant', version: '1.9.6'
+ }
+}
diff --git a/test-project/buildSrc/build.gradle b/test-project/buildSrc/build.gradle
index f5ddbbc..07aef7f 100644
--- a/test-project/buildSrc/build.gradle
+++ b/test-project/buildSrc/build.gradle
@@ -1,5 +1,5 @@
-apply plugin: 'java'
-
-dependencies {
- compile group: 'commons-net', name: 'commons-net', version: '3.0'
-}
+apply plugin: 'java'
+
+dependencies {
+ compile group: 'commons-net', name: 'commons-net', version: '3.0'
+}
diff --git a/test-project/debian/maven.ignoreRules b/test-project/debian/maven.ignoreRules
index 0f4cc27..952c379 100644
--- a/test-project/debian/maven.ignoreRules
+++ b/test-project/debian/maven.ignoreRules
@@ -1,2 +1,2 @@
-commons-compress commons-compress * * * *
-commons-io commons-io * * * *
+commons-compress commons-compress * * * *
+commons-io commons-io * * * *
diff --git a/test-project/debian/maven.rules b/test-project/debian/maven.rules
index d635987..9ff986c 100644
--- a/test-project/debian/maven.rules
+++ b/test-project/debian/maven.rules
@@ -1,3 +1,3 @@
-junit junit * s/.*/4.x/ * *
-cglib cglib * s/.*/3.x/ * *
-org.hsqldb hsqldb * s/.*/debian/ s/jdk5// *
+junit junit * s/.*/4.x/ * *
+cglib cglib * s/.*/3.x/ * *
+org.hsqldb hsqldb * s/.*/debian/ s/jdk5// *
diff --git a/test-project/init.gradle b/test-project/init.gradle
index e829e33..089b17c 100644
--- a/test-project/init.gradle
+++ b/test-project/init.gradle
@@ -1,9 +1,9 @@
-initscript {
- def home = System.properties['user.home']
- dependencies {
- classpath fileTree(dir: '../../../gradle-helper-plugin/target/', include: '*.jar')
- classpath fileTree(dir: home + '/.m2/repository/org/debian/maven/maven-repo-helper/1.8.10/', include: '*.jar')
- }
-}
-
-apply plugin: org.debian.gradle.DebianHelperPlugin
+initscript {
+ def home = System.properties['user.home']
+ dependencies {
+ classpath fileTree(dir: '../../../gradle-helper-plugin/target/', include: '*.jar')
+ classpath fileTree(dir: home + '/.m2/repository/org/debian/maven/maven-repo-helper/1.8.10/', include: '*.jar')
+ }
+}
+
+apply plugin: org.debian.gradle.DebianHelperPlugin
diff --git a/test-project/settings.gradle b/test-project/settings.gradle
index 64bebfd..2ceaa86 100644
--- a/test-project/settings.gradle
+++ b/test-project/settings.gradle
@@ -1,5 +1,5 @@
-include 'project1'
-include 'project2'
-
-project(":project1").projectDir = file("subprojects/project1")
-project(":project2").projectDir = file("subprojects/project2")
+include 'project1'
+include 'project2'
+
+project(":project1").projectDir = file("subprojects/project1")
+project(":project2").projectDir = file("subprojects/project2")
diff --git a/test-project/src/main/java/HelloWorld.java b/test-project/src/main/java/HelloWorld.java
index 1aba190..c6f1d05 100644
--- a/test-project/src/main/java/HelloWorld.java
+++ b/test-project/src/main/java/HelloWorld.java
@@ -1,7 +1,7 @@
-public class HelloWorld {
-
- public static void main(String[] args) {
- System.out.println("Hello World!");
- }
-
-}
+public class HelloWorld {
+
+ public static void main(String[] args) {
+ System.out.println("Hello World!");
+ }
+
+}
diff --git a/test-project/subprojects/project1/src/main/java/Project1.java b/test-project/subprojects/project1/src/main/java/Project1.java
index 04068e6..5abe26e 100644
--- a/test-project/subprojects/project1/src/main/java/Project1.java
+++ b/test-project/subprojects/project1/src/main/java/Project1.java
@@ -1,3 +1,3 @@
-public class Project1 {
-
-}
+public class Project1 {
+
+}
diff --git a/test-project/subprojects/project2/src/main/java/Project2.java b/test-project/subprojects/project2/src/main/java/Project2.java
index 3a28d40..3f7d37f 100644
--- a/test-project/subprojects/project2/src/main/java/Project2.java
+++ b/test-project/subprojects/project2/src/main/java/Project2.java
@@ -1,3 +1,3 @@
-public class Project2 {
-
-}
+public class Project2 {
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/gradle-debian-helper.git
More information about the pkg-java-commits
mailing list