Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,17 @@ jobs:
- name: Build nbms
run: ant $OPTS build-nbms

- name: Maven Install
run: |
# install all NBMs
ant maven-install -Dnbm.install.version=99-SNAPSHOT
# remove one
rm -r $HOME/.m2/repository/org/netbeans/api/org-openide-awt/99-SNAPSHOT/
# install a single NBM
ant -f platform/openide.awt maven-install -Dnbm.install.version=99-SNAPSHOT
# verify pom is installed
cat $HOME/.m2/repository/org/netbeans/api/org-openide-awt/99-SNAPSHOT/org-openide-awt-99-SNAPSHOT.pom

# runs only in PRs if requested; ~18 min
- name: Build all Tests
if: env.test_tests == 'true' && github.event_name == 'pull_request' && success()
Expand Down
71 changes: 68 additions & 3 deletions nbbuild/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,79 @@ metabuild.hash=${metabuild.hash}</echo>
<nbbrowse file="${netbeans.javadoc.dir}/index.html"/>
</target>

<!-- build source zips for selected modules - useful for populating maven repository only-->
<target name="build-source-zips" depends="init" description="Builds source zips for maven repository inclusion.">
<target name="-init-sources-zip" depends="init">
<property name="netbeans.zipped.sources.dir" location="${nb.build.dir}/source-zips" />

</target>

<!-- build source zips for selected modules - useful for populating maven repository only-->
<target name="build-source-zips" depends="init,-init-sources-zip" description="Builds source zips for maven repository inclusion.">
<subant-junit target="sources-zip" failonerror="true">
<buildpath path="${modules.sorted}"/>
</subant-junit>
</target>

<target name="maven-install" depends="init,-init-sources-zip" description="Finishes installation of artifacts into Maven repository">
<echo message="=== Run only after ===${line.separator} ant build-source-zips${line.separator} ant build-nbms${line.separator} ant build-javadoc${line.separator}=== Only then maven-install ===${line.separator}"/>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggests to run:

 ant build-source-zips
 ant build-nbms
 ant build-javadoc

but it doesn't run them to make the ant maven-install fast by itself.

With the most recent state of this PR the ant build-source-zips and ant build-javadoc are optional.


<!--
Inspired by following two invocations:

# https://github.com/apache/netbeans-jenkins-lib/blob/120b7fe817075c802dbc7f8cb59d5d218249e310/vars/asfMainNetBeansBuild.groovy#L200
mvn org.apache.maven.plugins:maven-dependency-plugin:3.5.0:get
-Dartifact=org.apache.netbeans.utilities:nb-repository-plugin:${nbm.plugin.version}
-DremoteRepositories=apache.snapshots.https::::https://repository.apache.org/snapshots

mvn org.apache.netbeans.utilities:nb-repository-plugin:${nbm.plugin.version}:populate
-X ${commonparam}
-DnetbeansNbmDirectory=${netbeansbase}/nbms
-DnetbeansInstallDirectory=${netbeansbase}/netbeans
-DnetbeansSourcesDirectory=${netbeansbase}/build/source-zips
-DnetbeansJavadocDirectory=${netbeansbase}/build/javadoc
-DparentGAV=org.apache.netbeans:netbeans-parent:5
-DforcedVersion=${nbm.install.version}
-DskipInstall=true
-DdeployId=apache.snapshots.https
-DdeployUrl=https://repository.apache.org/content/repositories/snapshots

# https://github.com/apache/netbeans-jenkins-lib/blob/120b7fe817075c802dbc7f8cb59d5d218249e310/vars/asfMainNetBeansBuild.groovy#L437
mvn org.apache.netbeans.utilities:nb-repository-plugin:${nbm.plugin.version}:populate
${commonparam}
-DnetbeansNbmDirectory=${netbeansbase}/nbms
-DnetbeansInstallDirectory=${netbeansbase}/netbeans
-DnetbeansSourcesDirectory=${netbeansbase}/build/source-zips
-DnetbeansJavadocDirectory=${netbeansbase}/build/javadoc
-DparentGAV=org.apache.netbeans:netbeans-parent:5
-DforcedVersion=${nbm.install.version}
-DskipInstall=true
-DdeployUrl=file://${env.WORKSPACE}/mavenrepository

zip zipFile:'mavenrepo.zip',dir:'mavenrepository',archive:'true'
-->
<property name="mavenArgs" value=""/>
<mkdir dir="nbms" />
<property name="base.nbm.target.dir" location="nbms" />
<condition property=".cmd" value=".cmd" else="">
<os family="windows"/>
</condition>
<condition property="exists.netbeansSourcesDirectory" value="true" else="false">
<available file="${netbeans.zipped.sources.dir}"/>
</condition>
<condition property="exists.netbeansJavadocDirectory" value="true" else="false">
<available file="${netbeans.javadoc.dir}"/>
</condition>
<exec executable="${maven.embedder.dir}/maven/bin/mvn${.cmd}" failonerror="true">
<arg value="org.apache.netbeans.utilities:nb-repository-plugin:${nbm.plugin.version}:populate"/>
<arg value="-DnetbeansInstallDirectory=${netbeans.dest.dir}"/>
<arg value="-DnetbeansNbmDirectory=${base.nbm.target.dir}"/>
<arg value="-DnetbeansSourcesDirectory=${netbeans.zipped.sources.dir}" if:true="${exists.netbeansSourcesDirectory}"/>
<arg value="-DnetbeansJavadocDirectory=${netbeans.javadoc.dir}" if:true="${exists.netbeansJavadocDirectory}"/>
<arg value="-DparentGAV=org.apache.netbeans:netbeans-parent:${nbm.install.parent.version}"/>
<arg value="-DforcedVersion=${nbm.install.version}"/>
<arg line="${mavenArgs}"/>
<env key="JAVA_HOME" value="${java.home}"/>
</exec>
<echo message="Installed -Dnbm.install.version=${nbm.install.version} into Maven repository with additional -DmavenArgs=${mavenArgs}"/>
</target>


<target name="check-javahelpbin" depends="init" description="Validate intermodule links in helpsets.">
Expand Down
10 changes: 10 additions & 0 deletions nbbuild/default-properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@

<property name="autoupdate.catalog.url" value="http://bits.netbeans.org/dev/nbms-and-javadoc/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz"/>

<!--
Version of [NetBeans Repository Plugin](https://bits.netbeans.org/mavenutilities/nbm-maven-plugin/nb-repository-plugin/index.html)
to use when handling `ant maven-install` invocation.
-->
<property name="nbm.plugin.version" value="14.5"/>
<!-- default version to use when installing into Maven repository -->
<property name="nbm.install.version" value="dev-SNAPSHOT"/>
<!-- default NBM pom parent version -->
<property name="nbm.install.parent.version" value="5"/>

<macrodef name="resolve">
<attribute name="name"/>
<attribute name="value"/>
Expand Down
8 changes: 4 additions & 4 deletions nbbuild/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@
<label>Build IDE (no ZIP file)</label>
<target>build-nozip</target>
</action>
<action>
<label>Maven Install</label>
<target>maven-install</target>
</action>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • to promote the "Maven Install" capability more
  • let's expose the action in the popup menu of nbbuild project
Maven Install action

<action>
<label>Clean Everything</label>
<target>clean</target>
Expand All @@ -196,10 +200,6 @@
<label>Run Commit Validation</label>
<target>commit-validation</target>
</action>
<action>
<label>apisupport</label>
<target>-Dname=apisupport rebuild-cluster</target>
</action>
</context-menu>
</view>
<subprojects/>
Expand Down
16 changes: 9 additions & 7 deletions nbbuild/templates/projectized.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@
<condition property="nbm.distribution" value="${dist.base}/${nbm}"> <!-- compatibility -->
<isset property="dist.base"/>
</condition>
<property name="dist.base.structured" value="http://deadlock.netbeans.org/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms"/>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, can we use the m2 URL protocol in all places that might want to consume this?

<property name="nbm.distribution" value="${dist.base.structured}/${cluster.dir}/${nbm}"/>
<property name="nbm.distribution" value="m2:/org.netbeans.modules:${code.name.base.dashes}:${nbm.install.version}:nbm"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The groupId is hardcoded to org.netbeans.modules, but nb-repository-plugin:populate puts modules with public packages under org.netbeans.api. E.g. after ant -f platform/openide.awt maven-install my local repo has only org/netbeans/api/org-openide-awt/dev-SNAPSHOT/, and there is no org/netbeans/modules/org-openide-awt. So m2:/org.netbeans.modules:org-openide-awt:dev-SNAPSHOT:nbm won't resolve for API modules. The JavaFX modules probably worked because they have no public packages.

Not a regression, since the deadlock URL didn't work either, but maybe the groupId should follow the same rule the plugin uses.

<property name="nbm.module.author" value=""/>
<property name="nbm.release.date" value=""/>
<property name="nbm.needs.restart" value="false"/>
Expand Down Expand Up @@ -894,9 +893,8 @@
</target>

<target name="patch-for-maven" depends="maven-install"/> <!-- deprecated -->
<target name="maven-install" depends="init" description="Installs a -D{mavenVersion} of this module into local Maven repository">
<target name="maven-install" depends="init" description="Installs a -D{nbm.install.version} of this module into local Maven repository">
<property name="maven.tmp" location="${build.dir}/mvn"/>
<property name="mavenVersion" value="dev-SNAPSHOT"/>
<delete dir="${maven.tmp}"/>
<property name="maven.tmp.nbms" location="${maven.tmp}/nbms"/>
<antcall target="nbm" inheritall="false">
Expand All @@ -919,17 +917,21 @@
<condition property=".cmd" value=".cmd" else="">
<os family="windows"/>
</condition>
<property name="mavenArgs" value=""/>
<exec executable="${maven.embedder.dir}/maven/bin/mvn${.cmd}" failonerror="true">
<arg value="-DforcedVersion=${mavenVersion}"/>
<arg value="-DforcedVersion=${nbm.install.version}"/>
<arg value="-DdefineCluster=false"/>
<arg value="-DdependencyRepositoryId=netbeans-snapshot"/>
<arg value="-DdependencyRepositoryUrl=https://repository.apache.org/content/groups/snapshots"/>
<arg value="-DnetbeansInstallDirectory=${maven.tmp.install}"/>
<arg value="-DnetbeansNbmDirectory=${maven.tmp.nbms}"/>
<arg value="-DnetbeansSourcesDirectory=${maven.tmp.sources}"/>
<arg value="-DnetbeansJavadocDirectory=${maven.tmp.javadoc}"/>
<arg value="org.apache.netbeans.utilities:nb-repository-plugin:14.5:populate"/>
<arg value="org.apache.netbeans.utilities:nb-repository-plugin:${nbm.plugin.version}:populate"/>
<arg line="${mavenArgs}"/>
<env key="JAVA_HOME" value="${java.home}"/>
</exec>
</target>
<echo message="Installed -Dnbm.install.version=${nbm.install.version} into Maven repository with additional -DmavenArgs=${mavenArgs}"/>
</target>

</project>
Loading