Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo Merge & Switch to tycho. #2135

Closed
12 tasks done
cdietrich opened this issue Jan 17, 2023 · 322 comments
Closed
12 tasks done

Repo Merge & Switch to tycho. #2135

cdietrich opened this issue Jan 17, 2023 · 322 comments
Assignees
Labels
Milestone

Comments

@cdietrich
Copy link
Member

cdietrich commented Jan 17, 2023

following the discussions in eclipse/xtext-core#2052 and #2133
we consider Repo Merge & Switch to tycho again

the following things we need to clarify

  • when to do what (M1,..,RC,GA)
  • monorepo including xtend ?
  • how to deal with (xtext-maven/*, xtext-xtend/*maven-plugin, xtext-web, gwt in xtext-lib), maybe time to drop some things?
  • how to "sign and deploy" and test it, maybe we can just sign and publish some lib and core artifacts, deploy them, let sonatype nexus validate it, but do not release them. or we build and mx. aölso how to validate the eclipse signing (how does ed in his report do that)
  • how to test if produced p2 and maven artifacts are proper (sample, client projects)
  • ....

cc @LorenzoBettini @szarnekow @kthoms

Thinks not to forget

  • website + website jobs
  • adapt github links on website(s) and source code refs
  • api-diff job
  • nightly builds of master with tests and different java and tycho versions (deploy only on changes ?!?)
  • oomph, finalize setup and point oomph catalogue to new loc
  • committer-activity-count
@cdietrich
Copy link
Member Author

ps: most repos contain a years old ade-newbuild branch with the experiments @ArneDeutsch did back then

@LorenzoBettini
Copy link
Contributor

the maven plugins can be part of the same repo without problems; I think they should.
I'm going to try to port xtext-lib, but I have no clue about gwt (I never used it).

@mmosconi1
Copy link

Hi. We did some bigger repository merge (4 into one) some time ago (actually containing a set of Xtext DSLs).
Two things you should consider first:

  1. Are there branches other than 'master' that should be preserved or even merged? Each branch has to be merged separately. In our case there were several maintenance and some feature branches that also needed to be merged while retaining history.
  2. Most likely you have to deal with same-named tags in the different repositories, e.g. release tags. In the end, each tag name must be unique in the targert repo. That's why we pre-processed them (in the original repositories, prior to migration) to add a prefix like "repo1/v1.2.3", repo2/v1.2.3".

To make things reproducible (and we did need some test iterations...) we wrote scripts to automate the whole process. I can provide them if you like.

@cdietrich
Copy link
Member Author

@LorenzoBettini i added some npm script to package json
https://github.com/eclipse/xtext-web/compare/cd_npm_experiments
so that test and optimize should be callable from maven via
https://github.com/aseovic/npm-maven-plugin#usage (or another node maven plugin)

@LorenzoBettini
Copy link
Contributor

@LorenzoBettini i added some npm script to package json https://github.com/eclipse/xtext-web/compare/cd_npm_experiments so that test and optimize should be callable from maven via https://github.com/aseovic/npm-maven-plugin#usage (or another node maven plugin)

@cdietrich I cherry picked your commit on my branch and added the frontend-maven-plugin (I think it's a mainstream one) LorenzoBettini/xtext-web@a8c964e

I don't know much about nodejs but I think I specified the goals correctly in the POM

By running mvn clean verify I can see this output (I only show a part of it).
I'm not an expert but I seem to understand that everything runs fine, doesn't it :)

[INFO] --------------< org.eclipse.xtext:org.eclipse.xtext.web >---------------
[INFO] Building Xtext Web API 2.30.0-SNAPSHOT                             [4/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ org.eclipse.xtext.web ---
[INFO] Deleting /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web/target
[INFO] 
[INFO] --- build-helper-maven-plugin:3.2.0:add-test-source (add-test-sources) @ org.eclipse.xtext.web ---
[INFO] Test Source directory: /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web/src/test/xtext-gen added.
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.1:install-node-and-npm (install node and npm) @ org.eclipse.xtext.web ---
[INFO] Installing node version v16.17.1
[INFO] Unpacking /Users/bettini/.m2/repository/com/github/eirslett/node/16.17.1/node-16.17.1-darwin-arm64.tar.gz into /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web/node/tmp
[INFO] Copying node binary from /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web/node/tmp/node-v16.17.1-darwin-arm64/bin/node to /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web/node/node
[INFO] Installed node locally.
[INFO] Installing npm version 8.15.0
[INFO] Unpacking /Users/bettini/.m2/repository/com/github/eirslett/npm/8.15.0/npm-8.15.0.tar.gz into /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web/node/node_modules
[INFO] Installed npm locally.
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.1:npm (npm ci) @ org.eclipse.xtext.web ---
[INFO] Running 'npm ci' in /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web
[INFO] 
[INFO] added 80 packages, and audited 81 packages in 457ms
[INFO] 
[INFO] 20 packages are looking for funding
[INFO]   run `npm fund` for details
[INFO] 
[INFO] found 0 vulnerabilities
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.1:npm (javascript tests) @ org.eclipse.xtext.web ---
[INFO] Running 'npm run test' in /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT test
[INFO] > mocha -u tdd --reporter dot src/test/js/*.js
[INFO] 
[INFO] 
[INFO] 
[INFO]   .....................................................
[INFO] 
[INFO]   53 passing (278ms)
[INFO] 
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.1:npm (optimize) @ org.eclipse.xtext.web ---
[INFO] Running 'npm run optimize' in /Users/bettini/work/xtext/xtext-sources/xtext-web/org.eclipse.xtext.web
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimize
[INFO] > npm run optimizeAce && npm run optimizeOrion && npm run optimizeCodeMirror
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeAce
[INFO] > npm run optimizeAceJs && npm run optimizeAceJsMin && npm run optimizeAceCss
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeAceJs
[INFO] > r.js -o src/main/js/requirejs-ace-config.js logLevel=2 out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-ace.js optimize=none
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeAceJsMin
[INFO] > r.js -o src/main/js/requirejs-ace-config.js logLevel=2 out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-ace.min.js optimize=uglify preserveLicenseComments=false
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeAceCss
[INFO] > r.js -o logLevel=2 cssIn=src/main/css/xtext/xtext-ace.css out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-ace.css
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeOrion
[INFO] > npm run optimizeOrionJs && npm run optimizeOrionJsMin && npm run optimizeOrionCss
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeOrionJs
[INFO] > r.js -o src/main/js/requirejs-orion-config.js logLevel=2 out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-orion.js optimize=none
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeOrionJsMin
[INFO] > r.js -o src/main/js/requirejs-orion-config.js logLevel=2 out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-orion.min.js optimize=uglify preserveLicenseComments=false
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeOrionCss
[INFO] > r.js -o logLevel=2 cssIn=src/main/css/xtext/xtext-orion.css out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-orion.css
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeCodeMirror
[INFO] > npm run optimizeCodeMirrorJs && npm run optimizeCodeMirrorJsMin && npm run optimizeCodeMirrorCss
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeCodeMirrorJs
[INFO] > r.js -o src/main/js/requirejs-codemirror-config.js logLevel=2 out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-codemirror.js optimize=none
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeCodeMirrorJsMin
[INFO] > r.js -o src/main/js/requirejs-codemirror-config.js logLevel=2 out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-codemirror.min.js optimize=uglify preserveLicenseComments=false
[INFO] 
[INFO] 
[INFO] > xtext@2.30.0-SNAPSHOT optimizeCodeMirrorCss
[INFO] > r.js -o logLevel=2 cssIn=src/main/css/xtext/xtext-codemirror.css out=build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-codemirror.css
[INFO] 

@cdietrich
Copy link
Member Author

cdietrich commented Feb 2, 2023

@LorenzoBettini this looks good.
the question is:
here is how the jar looks like with gradle

jar tf org.eclipse.xtext.web-2.27.0-SNAPSHOT.jar | grep js
META-INF/resources/xtext/2.27.0-SNAPSHOT/xtext-ace.js
META-INF/resources/xtext/2.27.0-SNAPSHOT/xtext-ace.min.js
META-INF/resources/xtext/2.27.0-SNAPSHOT/xtext-codemirror.js
META-INF/resources/xtext/2.27.0-SNAPSHOT/xtext-codemirror.min.js
META-INF/resources/xtext/2.27.0-SNAPSHOT/xtext-orion.js
META-INF/resources/xtext/2.27.0-SNAPSHOT/xtext-orion.min.js

in your jar they are not packaged
maybe the build/opt-resources/META-INF/resources/xtext/${npm_package_version}/xtext-codemirror.css expressions also need adaptation

@LorenzoBettini
Copy link
Contributor

I've been working on that, and now they are:
Screenshot 2023-02-02 at 19 13 39

@LorenzoBettini
Copy link
Contributor

I've basically updated all the projects (with tests as well).

The one that remains to be done is org.eclipse.xtext.web.example.jetty.

That one is not meant to be deployed to Maven Central, is it?
I don't see it on Maven Central.
That is a WAR project I guess.

@cdietrich
Copy link
Member Author

yes and no. its not deployed. but it does two things.
it produces a war to test
there is a gradlew jettyRun command that status jetty locally to test (basically running the org.eclipse.xtext.web.example.jetty.ServerLauncher, same as if you would run it from eclipse)

@LorenzoBettini
Copy link
Contributor

yes and no. its not deployed. but it does two things. it produces a war to test there is a gradlew jettyRun command that status jetty locally to test (basically running the org.eclipse.xtext.web.example.jetty.ServerLauncher, same as if you would run it from eclipse)

Let's see what I can do with that project. I see that also Orion has to be downloaded...

@cdietrich
Copy link
Member Author

yes there is unfortunately no webjar for it

@LorenzoBettini
Copy link
Contributor

So, I converted also that project and configured the POM to download and unzip Orion.

If I run the example I get this, which looks fine, right?

image

@cdietrich
Copy link
Member Author

yes. and the same should work for ace and codemirror

@LorenzoBettini
Copy link
Contributor

ace and codemirror were already working because they are part of our sources; Orion instead had to be downloaded and unzipped

@szarnekow
Copy link
Contributor

Great work, @LorenzoBettini ! I'm amazed how you powered through this involving change of the build infra. I'm really looking forward to merging this after the release and then tackle the repo merge.

@cdietrich
Copy link
Member Author

cdietrich commented Feb 3, 2023

again my question: can we already downport parts like manifest/build.properties changes and renamings?

@szarnekow
Copy link
Contributor

Starting with the class renames would make sense. Having these consistent prior to the subsequent changes, allows for easier diffing the results.

@LorenzoBettini
Copy link
Contributor

@cdietrich, I forgot to answer your past question: I'm not sure what you meant. If you mean merging the PRs, I'd first need a few small adjustments and, most of all, harmonize xtext-maven (and I'm not yet done with xtext-web).

@szarnekow thank you for the kind words :) For sure, concerning xtext-web, I wouldn't be able to port the node part without the help of Christian.

I'd also need some additional information concerning the org.eclipse.xtext.web.example.jetty. The last part that I still have to do is packaging /org.eclipse.xtext.web.example.jetty/test-files. I'm currently running the example server from Eclipse, so those files are found. But they need to be packaged into the WAR file.

By looking at the build.gradle

task zipTestFiles(type: Zip) {
	from('test-files') {
		include '**/*'
		into 'test-files'
	}
	destinationDirectory = new File( project.buildDir,'libs')
	archiveFileName = 'test-files.zip'
}

I seem to understand that the contents of test-files directory must be zipped and put into the output folder inside "libs"?

If you already have a WAR file generated using the current configuration, could you please show me the expected layout of the WAR?

This is the current layout (without test-libs):

org.eclipse.xtext.web.example.jetty-2.30.0-SNAPSHOT
├── ace-statemachine-resource.html
├── ace-statemachine-resource-multi.html
├── ace-statemachine-stateless.html
├── ace-statemachine-static.html
├── ace-statemachine-static-multi.html
├── codemirror-statemachine-resource.html
├── codemirror-statemachine-resource-multi.html
├── codemirror-statemachine-stateless.html
├── codemirror-statemachine-static.html
├── codemirror-statemachine-static-multi.html
├── favicon.ico
├── i18n.js
├── images
│   └── output.gif
├── index.html
├── META-INF
├── orion
│   ├── code_edit
│   │   ├── built-codeEdit-amd.js
│   │   ├── built-codeEdit-amd.min.js
│   │   ├── built-codeEdit.css
│   │   ├── built-codeEdit.js
│   │   └── built-codeEdit.min.js
│   ├── javascript
│   │   └── plugins
│   │       ├── javascriptPlugin.html
│   │       ├── javascriptPlugin.js
│   │       ├── javascriptPlugin-non-minified.js
│   │       ├── ternWorkerCore.js
│   │       ├── ternWorkerCore-non-minified.js
│   │       └── ternWorker.js
│   ├── orion
│   │   ├── require-config.js
│   │   └── requireErrorHandler.js
│   ├── others
│   │   └── plugins
│   │       ├── jslintPlugin.html
│   │       ├── jslintPlugin.js
│   │       └── languages
│   │           └── json
│   │               ├── jsonPlugin.html
│   │               └── jsonPlugin.js
│   ├── plugins
│   │   ├── embeddedToolingPlugin.html
│   │   └── embeddedToolingPlugin.js
│   ├── requirejs
│   │   └── require.min.js
│   └── webtools
│       └── plugins
│           ├── webToolsPlugin.html
│           └── webToolsPlugin.js
├── orion-entities-resource.html
├── orion-entities-static.html
├── orion-statemachine-autogenerate.html
├── orion-statemachine-resource.html
├── orion-statemachine-resource-multi.html
├── orion-statemachine-stateless.html
├── orion-statemachine-static.html
├── orion-statemachine-static-multi.html
├── style.css
├── WEB-INF
│   ├── classes
│   │   └── org
│   │       └── eclipse
│   │           └── xtext
│   │               └── web
│   │                   └── example
│   │                       └── jetty
│   │                           ├── AbstractEntitiesWebModule.class
│   │                           ├── AbstractStatemachineWebModule.class
│   │                           ├── EntitiesWebModule.class
│   │                           ├── EntitiesWebSetup.class
│   │                           ├── MyXtextServlet.class
│   │                           ├── resource
│   │                           │   ├── StatemachineContentTypeProvider.class
│   │                           │   └── StatemachineResourceSetProvider.class
│   │                           ├── ServerLauncher$1.class
│   │                           ├── ServerLauncher.class
│   │                           ├── StatemachineWebModule.class
│   │                           └── StatemachineWebSetup.class
│   └── lib
│       ├── ace-1.3.3.jar
│       ├── antlr-runtime-3.2.jar
│       ├── aopalliance-1.0.jar
│       ├── asm-9.4.jar
│       ├── checker-qual-3.5.0.jar
│       ├── classgraph-4.8.149.jar
│       ├── codemirror-5.41.0.jar
│       ├── error_prone_annotations-2.3.4.jar
│       ├── failureaccess-1.0.1.jar
│       ├── gson-2.9.1.jar
│       ├── guava-30.1-jre.jar
│       ├── guice-5.0.1.jar
│       ├── j2objc-annotations-1.3.jar
│       ├── javax.inject-1.jar
│       ├── jquery-3.6.0.jar
│       ├── jsr305-3.0.2.jar
│       ├── listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
│       ├── log4j-1.2.17.jar
│       ├── org.eclipse.emf.common-2.24.0.jar
│       ├── org.eclipse.emf.ecore-2.26.0.jar
│       ├── org.eclipse.emf.ecore.change-2.14.0.jar
│       ├── org.eclipse.emf.ecore.xmi-2.16.0.jar
│       ├── org.eclipse.equinox.common-3.16.200.jar
│       ├── org.eclipse.lsp4j-0.19.0.jar
│       ├── org.eclipse.lsp4j.generator-0.19.0.jar
│       ├── org.eclipse.lsp4j.jsonrpc-0.19.0.jar
│       ├── org.eclipse.osgi-3.18.100.jar
│       ├── org.eclipse.xtend.lib-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtend.lib.macro-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.common.types-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.ide-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.util-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.web-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.web.example.entities-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.web.example.entities.ide-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.web.example.statemachine-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.web.example.statemachine.ide-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.web.servlet-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.xbase-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.xbase.ide-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.xbase.lib-2.30.0-SNAPSHOT.jar
│       ├── org.eclipse.xtext.xbase.web-2.30.0-SNAPSHOT.jar
│       ├── reload4j-1.2.24.jar
│       ├── requirejs-2.3.6.jar
│       ├── requirejs-text-2.0.15.jar
│       ├── slf4j-api-1.7.33.jar
│       └── slf4j-log4j12-1.7.33.jar
└── xtext
    ├── ace-mode-entities.js
    ├── ace-mode-statemachine.js
    ├── cm-mode-entities.js
    ├── cm-mode-statemachine.js
    ├── entities-syntax.js
    └── statemachine-syntax.js

@cdietrich
Copy link
Member Author

Great work, @LorenzoBettini ! I'm amazed how you powered through this involving change of the build infra. I'm really looking forward to merging this after the release and then tackle the repo merge.

+1 on that

@LorenzoBettini no i dont mean merge the prs. i mean merge parts of the changes that can be safely done on master.

@cdietrich
Copy link
Member Author

about the jetty war. i have no idea about the testlibs. this also might be a bug.
here is from master:

META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/org/
WEB-INF/classes/org/eclipse/
WEB-INF/classes/org/eclipse/xtext/
WEB-INF/classes/org/eclipse/xtext/web/
WEB-INF/classes/org/eclipse/xtext/web/example/
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/ServerLauncher.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/StatemachineWebModule.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/AbstractStatemachineWebModule.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/EntitiesWebSetup.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/resource/
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/resource/StatemachineContentTypeProvider.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/resource/StatemachineResourceSetProvider.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/ServerLauncher$1.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/StatemachineWebSetup.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/AbstractEntitiesWebModule.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/MyXtextServlet.class
WEB-INF/classes/org/eclipse/xtext/web/example/jetty/EntitiesWebModule.class
WEB-INF/lib/
WEB-INF/lib/org.eclipse.xtext.web.servlet-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.web.example.statemachine.ide-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.xbase.web-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.web.example.entities.ide-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.web-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.web.example.statemachine-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.xbase.ide-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.ide-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.web.example.entities-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.xbase-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.common.types-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.util-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.lsp4j-0.19.0.jar
WEB-INF/lib/org.eclipse.lsp4j.generator-0.19.0.jar
WEB-INF/lib/org.eclipse.xtend.lib-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtend.lib.macro-2.30.0-SNAPSHOT.jar
WEB-INF/lib/org.eclipse.xtext.xbase.lib-2.30.0-SNAPSHOT.jar
WEB-INF/lib/requirejs-text-2.0.15.jar
WEB-INF/lib/requirejs-2.3.6.jar
WEB-INF/lib/jquery-3.6.0.jar
WEB-INF/lib/ace-1.3.3.jar
WEB-INF/lib/codemirror-5.41.0.jar
WEB-INF/lib/slf4j-reload4j-1.7.36.jar
WEB-INF/lib/reload4j-1.2.24.jar
WEB-INF/lib/guice-5.0.1.jar
WEB-INF/lib/aopalliance-1.0.jar
WEB-INF/lib/guava-30.1-jre.jar
WEB-INF/lib/jsr305-3.0.2.jar
WEB-INF/lib/error_prone_annotations-2.3.4.jar
WEB-INF/lib/classgraph-4.8.149.jar
WEB-INF/lib/antlr-runtime-3.2.jar
WEB-INF/lib/org.eclipse.emf.ecore.change-2.14.0.jar
WEB-INF/lib/org.eclipse.emf.ecore.xmi-2.16.0.jar
WEB-INF/lib/org.eclipse.emf.ecore-2.26.0.jar
WEB-INF/lib/org.eclipse.emf.common-2.24.0.jar
WEB-INF/lib/org.eclipse.lsp4j.jsonrpc-0.19.0.jar
WEB-INF/lib/org.eclipse.equinox.common-3.16.200.jar
WEB-INF/lib/org.eclipse.osgi-3.18.100.jar
WEB-INF/lib/gson-2.9.1.jar
WEB-INF/lib/slf4j-api-1.7.36.jar
WEB-INF/lib/javax.inject-1.jar
WEB-INF/lib/failureaccess-1.0.1.jar
WEB-INF/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
WEB-INF/lib/checker-qual-3.5.0.jar
WEB-INF/lib/j2objc-annotations-1.3.jar
ace-statemachine-static-multi.html
codemirror-statemachine-static.html
codemirror-statemachine-stateless.html
ace-statemachine-resource.html
orion-entities-static.html
orion/
orion/webtools/
orion/webtools/plugins/
orion/webtools/plugins/webToolsPlugin.html
orion/webtools/plugins/webToolsPlugin.js
orion/requirejs/
orion/requirejs/require.min.js
orion/javascript/
orion/javascript/plugins/
orion/javascript/plugins/ternWorker.js
orion/javascript/plugins/javascriptPlugin.js
orion/javascript/plugins/ternWorkerCore-non-minified.js
orion/javascript/plugins/ternWorkerCore.js
orion/javascript/plugins/javascriptPlugin.html
orion/javascript/plugins/javascriptPlugin-non-minified.js
orion/orion/
orion/orion/requireErrorHandler.js
orion/orion/require-config.js
orion/others/
orion/others/plugins/
orion/others/plugins/jslintPlugin.js
orion/others/plugins/languages/
orion/others/plugins/languages/json/
orion/others/plugins/languages/json/jsonPlugin.html
orion/others/plugins/languages/json/jsonPlugin.js
orion/others/plugins/jslintPlugin.html
orion/code_edit/
orion/code_edit/built-codeEdit-amd.js
orion/code_edit/built-codeEdit.js
orion/code_edit/built-codeEdit.css
orion/code_edit/built-codeEdit.min.js
orion/code_edit/built-codeEdit-amd.min.js
orion/plugins/
orion/plugins/embeddedToolingPlugin.html
orion/plugins/embeddedToolingPlugin.js
ace-statemachine-static.html
index.html
orion-statemachine-autogenerate.html
codemirror-statemachine-static-multi.html
style.css
codemirror-statemachine-resource-multi.html
orion-statemachine-static.html
images/
images/output.gif
ace-statemachine-resource-multi.html
favicon.ico
orion-entities-resource.html
ace-statemachine-stateless.html
xtext/
xtext/cm-mode-statemachine.js
xtext/entities-syntax.js
xtext/cm-mode-entities.js
xtext/ace-mode-statemachine.js
xtext/ace-mode-entities.js
xtext/statemachine-syntax.js
codemirror-statemachine-resource.html
orion-statemachine-resource.html
orion-statemachine-stateless.html
i18n.js
orion-statemachine-resource-multi.html
orion-statemachine-static-multi.html

@LorenzoBettini
Copy link
Contributor

mh... there's no trace of test-libs. If you run the example with jetty, you should get an error when trying to select one of the resources:

image

@cdietrich
Copy link
Member Author

cdietrich commented Feb 3, 2023

this trys to load file from disk.
see
https://github.com/eclipse/xtext-umbrella/blob/0c7d12aa264b140279658c0d416ca590ca667d2c/releng/docker/xtext-web-deploy/Jenkinsfile#L24

i dont know to which path this points to in your example
so the question would be what is the "." dir in gradle if jetty is run

@LorenzoBettini
Copy link
Contributor

@cdietrich can you please confirm that if you run jetty (with gradle) from that project it finds the test input files or it doesn't?

The Jenkinsfile doesn't tell me much, because it only seems to confirm that the test files are not in the WAR.

@cdietrich
Copy link
Member Author

it is. and they are picked separately from filesystem. so that they also can be written/saved

Bildschirmfoto vom 2023-02-03 10-39-43

@LorenzoBettini
Copy link
Contributor

the problem is. you need a shell script to tell the maven version wont you?

Of course I'm not saying to ban shell scripts at all ;)
I'm just saying that a shell script shouldn't do much more than calling a Maven command.
I meant I wouldn't use a shell script to manually replace versions with regex in files.

@LorenzoBettini
Copy link
Contributor

@cdietrich I'm still not able to solve the problem of milestone in my project, without applying the solution I proposed above (which is the one currently part of Xtext monorepo) consisting in passing the additional property for milestone. Note that this means that, if we ever switch to a single command for releasing Maven artifacts and p2 site, we won't still be able to do that for milestones.

I also found this eclipse/mwe#112 which confirms you had the same problem... I still don't understand your solution though. I seem to understand that you use the shell script only to replace versions. I think I come up with the same version replacement without the shell script. When running the Maven build I don't understand why it works for you and not for my simple project.

@LorenzoBettini
Copy link
Contributor

@cdietrich I found your hack ;) https://github.com/eclipse/mwe/blob/master/set_version.sh#L123

you manually replace .qualifier with the timestamp before the build in the source MANIFEST! That's why it works for you and that's why the resulting v2022... appears in the final JARs in spite in the POM there's another configuration for the qualifier replacement.

When the Maven/Tycho build runs there's no .qualifier at all in manifests, just the timestamps.

I'll see whether this can be achieved in a cleaner way (same result but without shell hacks)

@cdietrich
Copy link
Member Author

i see.

@LorenzoBettini
Copy link
Contributor

@cdietrich So I managed to make it work in my simple example. More technical details later. In the meantime, here are the results (note: they're shell scripts but they only invoke Maven command):

STANDARD BUILD

mvn clean package

Maven-version: 1.0.0-SNAPSHOT
Bundle-Version: 1.0.0.v20230318-1815

RELEASE

./prepare-for-release.sh
mvn clean package -Pp2-release
diff --git a/org.example.feature/feature.xml b/org.example.feature/feature.xml
index 0f67cda..b3b3f50 100644
--- a/org.example.feature/feature.xml
+++ b/org.example.feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.example.feature"
       label="Example Feature"
-      version="1.0.0.qualifier"
+      version="1.0.0.v20230318-1827"
       provider-name="Lorenzo Bettini">
 
    <description url="http://www.example.com/description">
diff --git a/org.example.feature/pom.xml b/org.example.feature/pom.xml
index 7337a44..8a0d05f 100644
--- a/org.example.feature/pom.xml
+++ b/org.example.feature/pom.xml
@@ -8,7 +8,7 @@
                <relativePath>../org.example.parent/pom.xml</relativePath>
                <groupId>org.example</groupId>
                <artifactId>org.example.parent</artifactId>
-               <version>1.0.0-SNAPSHOT</version>
+               <version>1.0.0</version>
Maven-version: 1.0.0
Bundle-Version: 1.0.0.v20230318-1827

MILESTONE

./prepare-for-milestone.sh M1
mvn clean package -Pp2-release
diff --git a/org.example.feature/feature.xml b/org.example.feature/feature.xml
index 0f67cda..b183616 100644
--- a/org.example.feature/feature.xml
+++ b/org.example.feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.example.feature"
       label="Example Feature"
-      version="1.0.0.qualifier"
+      version="1.0.0.v20230318-1830"
       provider-name="Lorenzo Bettini">
 
    <description url="http://www.example.com/description">
diff --git a/org.example.feature/pom.xml b/org.example.feature/pom.xml
index 7337a44..71708fc 100644
--- a/org.example.feature/pom.xml
+++ b/org.example.feature/pom.xml
@@ -8,7 +8,7 @@
                <relativePath>../org.example.parent/pom.xml</relativePath>
                <groupId>org.example</groupId>
                <artifactId>org.example.parent</artifactId>
-               <version>1.0.0-SNAPSHOT</version>
+               <version>1.0.0.M1</version>
Maven-version: 1.0.0.M1
Bundle-Version: 1.0.0.v20230318-1830

@LorenzoBettini
Copy link
Contributor

@cdietrich some more technical details about the solution. I've tested in my simple project https://github.com/LorenzoBettini/tycho-archive-example where I also have GitHub Actions jobs to simulate snapshot, release, and milestone; a Tycho integration test verifying the expected bundle and maven versions in the manifest in the 3 different scenarios; the jobs produce p2 sites that can be manually inspected for the 3 scenarios (e.g., https://github.com/LorenzoBettini/tycho-archive-example/actions/runs/4467446821).

The modification of MANIFEST have already been explained previously and already been applied to Xtext.
The following is the solution for keeping timestamps in MANIFEST/features and M1 or no snapshots in POMs for milestones and releases, respectively.

For releases and milestones, the idea is to first use Tycho versions plugin to change 1.0.0-SNAPSHOT and 1.0.0.qualifier into something like 1.0.0.v2023.... Tycho will consistently update all the versions in MANIFEST, feature.xml and POMs, considering possible references. Then, use the Maven versions plugin to change the POMs' versions to 1.0.0 for releases and 1.0.0.M1 for milestones. There's no way to force Tycho versions plugin to ignore the POMs when updating versions, so we have to do these two steps one after the other.

The parent POM contains the property:

<timestamp-pattern>'v'yyyyMMdd-HHmm</timestamp-pattern>

used consistently in the rest of the POM. If for any reason, we want a different format, we need to change a single property.

For example,

<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>tycho-packaging-plugin</artifactId>
	<version>${tycho-version}</version>
	<configuration>
		<format>${timestamp-pattern}</format>
		<skipPomGeneration>true</skipPomGeneration>
	</configuration>
</plugin>

There's a profile (just to make sure the goal is not called unintentionally), using the build helper plugin to compute the timestamp according to the same format and set it in the property computedTimestamp; it configures an execution meant to be called manually from the shell script (so phase none):

<profile>
	<id>replace-qualifier-with-timestamp</id>
	<build>
		<plugins>
			<!-- meant to be called explicitly via the goal syntax:
				build-helper:timestamp-property@timestamp -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>timestamp</id>
						<goals>
							<goal>timestamp-property</goal>
						</goals>
						<phase>none</phase>
						<configuration>
							<name>computedTimestamp</name>
							<pattern>${timestamp-pattern}</pattern>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</profile>

Now we have shells scripts to call Maven goals.

For example, to turn qualifiers/snapshots into timestamps (replace-qualifier-with-timestamp.sh):

#!/bin/sh

mvn \
  -Preplace-qualifier-with-timestamp \
  build-helper:parse-version \
  build-helper:timestamp-property@timestamp \
  org.eclipse.tycho:tycho-versions-plugin:set-version \
  -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}.\${computedTimestamp} \
  -DgenerateBackupPoms=false

build-helper:parse-version sets the version properties with major, minor and incremental that are used to compute the version to be replaced, together with computedTimestamp with the timestamp.

Another shell script remove-snapshots-poms.sh, removes the qualifiers from POMs:

#!/bin/sh

mvn \
  build-helper:parse-version \
  versions:set \
  -DgenerateBackupPoms=false \
  -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}

Another shell script set-milestone-poms.sh replaces the qualifiers in POMs with the passed milestone number:

#!/bin/sh

if [ $# -eq 0 ]; then
    echo "No arguments provided: pass the milestone, e.g., M1"
    exit 1
fi

mvn \
  build-helper:parse-version \
  versions:set \
  -DgenerateBackupPoms=false \
  -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}.$1

Then, there are the two main scripts that call appropriately the previous ones.

One for preparing for a release prepare-for-release.sh:

#!/bin/sh

script_dir="$(dirname "${BASH_SOURCE:-$0}")"

${script_dir}/replace-qualifier-with-timestamp.sh && \
${script_dir}/remove-snapshots-poms.sh

One for preparing for a milestone prepare-for-milestone.sh:

#!/bin/sh

if [ $# -eq 0 ]; then
    echo "No arguments provided: pass the milestone, e.g., M1"
    exit 1
fi

script_dir="$(dirname "${BASH_SOURCE:-$0}")"

${script_dir}/replace-qualifier-with-timestamp.sh && \
${script_dir}/set-milestone-poms.sh $1

Of course, when then performing the build with the modified versions, we must tell Tycho to ignore the differences between OSGI and POMs; there's a profile to be activated (it's the same for release and milestone):

<profile>
	<id>p2-release</id>
	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-packaging-plugin</artifactId>
				<configuration>
					<strictVersions>false</strictVersions>
				</configuration>
			</plugin>
		</plugins>
	</build>
</profile>

It's simpler than it may sound ;)
Moreover, it does not require manual processing of versions, and just uses shell scripts to call Maven commands.

@cdietrich
Copy link
Member Author

@LorenzoBettini will this also work in future tycho versions or do we have to adapt the the tycho versions plugin is more coupled to the maven versions plugin

@LorenzoBettini
Copy link
Contributor

@cdietrich I've just tested my project with Tycho 3.0.4 and it works as before

@cdietrich
Copy link
Member Author

@LorenzoBettini i assume we can close this one as done and handle remainders with separate issues

@HannesWell
Copy link
Member

@LorenzoBettini i assume we can close this one as done and handle remainders with separate issues

Great 🎉
While having q quick look at this repo's new content I wondered if you have considered to switch to a structured build layout for the repository as described in Tycho:
https://tycho.eclipseprojects.io/doc/master/StructuredBuild.html#structured-build-layout
This avoids the need to list all modules explicitly.

@szarnekow
Copy link
Contributor

The main focus was on keeping the history and retain the existing committers knowledge about the code structure. Listing a few dozen modules is no real burden compared to the need for additional code research in the daily work of triage or code archeology.

@HannesWell
Copy link
Member

If git detects that a file was moved (i.e. a added file is similar enough to a deleted file) then the history from before the move is retained and the git blame contains the same information as before. So this does not have an influence on the per line git-blame, unless you also change some lines while renaming the file. The rename is also considered in the history view of EGit where it shows commits touching the previous file name when you select to show only changes of the selected resource.

@LorenzoBettini
Copy link
Contributor

@LorenzoBettini i assume we can close this one as done and handle remainders with separate issues

@cdietrich Yes, I guess this one can be closed.

@HannesWell I'm not a big fun of POMless build ;) , but if others think about restructuring I'm OK with that.

@cdietrich
Copy link
Member Author

yes will close.
leftovers will be handled by separate issues

@HannesWell
Copy link
Member

HannesWell commented Apr 7, 2023

@HannesWell I'm not a big fun of POMless build ;) , but if others think about restructuring I'm OK with that.

May I ask you why that's the case?
Given that the projects are 'Manifest-first' PDE Plugin projects pomless allows one to avoid duplicated build information in the pom.xml, which usually leads to less maintenance work.
Of course it is also valid to choose a 'pom-first' approach, which means you effectively have a Maven project (or gradle if that is still used) and generate the Manifest using the maven-bundle-plugin or bnd-maven-plugin.
But using both is often just duplicated information and therefore unnecessary extra work. Of course there are some cases where a pom is required in a Manifest-first project.

@cdietrich
Copy link
Member Author

@HannesWell i dont trust the autogenerated poms to publish to maven central at all

@LorenzoBettini
Copy link
Contributor

@HannesWell I had a few problems in the past with pomless builds (in other projects). Moreover, as said by @cdietrich , the poms generated by Tycho give a few problems: they are not consumable by Maven plugins (at least, that's my experience in the past; I tried several times and it didn't work).

With a well-curated parent POM, the poms in bundle and feature projects are minimal. In test projects, we typically still have to write a few additional configurations.

@HannesWell
Copy link
Member

@HannesWell I had a few problems in the past with pomless builds (in other projects). Moreover, as said by @cdietrich , the poms generated by Tycho give a few problems: they are not consumable by Maven plugins (at least, that's my experience in the past; I tried several times and it didn't work).

Understand. Have you considered a pom-first approach then where you basically make the projects Maven projects and generate the OSGi Manifest using the maven-bundle-plugin or bnd-maven-plugin? You would then save the duplicated dependency handling and the generated Manifest is often more accurate and 'better'. And m2e has a connector built in so that those projects can participate in the regular PDE workspace build with the generated manifest.
Tycho also supports mixed reactors so that those Maven projects could also be used for example in features or to build p2-repos. We use that for example in m2e.

@cdietrich
Copy link
Member Author

yes. but also the bnd tools produces funny stuff. had also not found out how to properly build/test eclpse ui stuff with it

@HannesWell
Copy link
Member

yes. but also the bnd tools produces funny stuff. had also not found out how to properly build/test eclpse ui stuff with it

OK. Yes If one wants to have a non default configuration (at least what the bnd-devs think is the best default) it requires some set up to produce the desired results.
When you tried that, did you use the M2E-PDE connector and a mixed Tycho reactor?

@LorenzoBettini
Copy link
Contributor

@HannesWell I had a few problems in the past with pomless builds (in other projects). Moreover, as said by @cdietrich , the poms generated by Tycho give a few problems: they are not consumable by Maven plugins (at least, that's my experience in the past; I tried several times and it didn't work).

Understand. Have you considered a pom-first approach then where you basically make the projects Maven projects and generate the OSGi Manifest using the maven-bundle-plugin or bnd-maven-plugin? You would then save the duplicated dependency handling and the generated Manifest is often more accurate and 'better'. And m2e has a connector built in so that those projects can participate in the regular PDE workspace build with the generated manifest. Tycho also supports mixed reactors so that those Maven projects could also be used for example in features or to build p2-repos. We use that for example in m2e.

@HannesWell that sounds much more complicated than the current approach ;)
And the current approach is not that bad after all.

@HannesWell
Copy link
Member

@HannesWell that sounds much more complicated than the current approach ;)
And the current approach is not that bad after all.

That probably depends on the details, but if you are happy with it how it is, that's of course fine :)

@cdietrich
Copy link
Member Author

commiter activity count will be done manually for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants