Skip to content

Commit e5f02bc

Browse files
committed
Initial commit
0 parents  commit e5f02bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3360
-0
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
* text=auto eol=lf
2+
*.java text eol=lf
3+
*.properties text eol=lf
4+
*.css text eol=lf
5+
*.html text eol=lf
6+
*.xhtml text eol=lf
7+
*.dtd text eol=lf
8+
*.ent text eol=lf
9+
*.txt text
10+
*.bat text eol=crlf
11+
*.sh text eol=lf
12+
*.xml text eol=lf
13+
*.bin binary
14+
*.png binary

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Build CI workflow
2+
3+
name: CI
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
# Allows to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
name: Java build
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
# Set JDK
25+
- name: Set up JDK
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '11'
29+
distribution: 'temurin'
30+
31+
# Build
32+
- name: Build with Gradle
33+
run: ./gradlew build

.github/workflows/publish-package.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will build a package using Gradle and then deploy it to GitHub
2+
# packages when a release is published
3+
4+
name: Github Packages
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
server-id: github
26+
settings-path: ${{ github.workspace }}
27+
28+
- name: Build with Gradle
29+
run: ./gradlew build -x test
30+
31+
- name: Publish to GitHub Packages
32+
run: ./gradlew publish -PmavenReleaseRepoUrl="https://maven.pkg.github.com/css4j/cssom-apis" -PmavenRepoUsername=${{ github.actor }} -PmavenRepoPassword=${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*~
2+
.classpath
3+
.project
4+
.settings
5+
*/bin/
6+
**/build/
7+
/.idea
8+
/.gradle
9+
/buildSrc/.gradle

CONTRIBUTING.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Contributing to CSSOM-APIs
2+
3+
You can contribute to this project by raising issues and/or sending `git` pull
4+
requests.
5+
6+
<br/>
7+
8+
## Report issues
9+
10+
If you find any issue with the software or want to ask for an enhancement, use
11+
the Github's [issue tracker](https://github.com/css4j/cssom-apis/issues).
12+
13+
<br/>
14+
15+
## Pull requests
16+
17+
To contribute code to this project it is recommended to open an issue first,
18+
explaining the rationale for the changes that you want to implement. Then, in
19+
the title of the pull request (PR) you can include a reference like "fixes #NN"
20+
where NN is the issue number. And it is generally a good idea to base your PR on
21+
a branch that was named after the issue; for example your branch could be named
22+
`issue-14`.
23+
24+
A PR should only try to fix a single issue, unless it fixes two or more issues
25+
that are very related or effectively the same. And if a commit has two or more
26+
different purposes, it is often better to split it in multiple commits; tools
27+
like the _Git GUI_ are particularly useful for that.
28+
29+
<br/>
30+
31+
### Commit messages
32+
33+
It is recommended that commit messages (or at least the message for the main
34+
commit) start with a prefix related to the API being affected. For example:
35+
```
36+
smil: change return type of function. Fixes #2.
37+
```
38+
If the commit has a wider scope than a single area, you do not need to include
39+
any prefix, for example:
40+
```
41+
Add .gitattributes file.
42+
```
43+
The commit should focus on a specific task, and its descriptive message should
44+
tell accurately what the commit does. For example, do not mix bug fixes with
45+
arbitrary clean-ups, unless the clean-up is part of the fix.
46+
47+
Although it is acceptable to include a small, unrelated code formatting fix
48+
inside a bug-fixing commit (like a small indentation fix in the same file), if
49+
the commit contains several formatting changes they should be split to a
50+
different commit. That eases the task of future code reviewers.
51+
52+
<br/>
53+
54+
### Code style
55+
56+
The code style could be summarized by the following points:
57+
58+
- Indent by tabs, not spaces. The automated formatting provided by the Eclipse
59+
IDE is often used.
60+
- Avoid trailing whitespace except for empty lines in Javadoc comments.
61+
- `if`-`else` blocks should always use curly braces, even if a single line of
62+
code is involved.
63+
- Long, descriptive variable names are preferred.
64+
- Add comments to explain what the code is trying to do, but avoiding useless
65+
prose that just mimics the code, like _"check if foo is larger than 1"_ as a
66+
comment to `if (foo > 1)`.
67+
- Public and protected methods must have documentation comments.
68+
- Code readability should not be sacrificed for compactness, unless there are
69+
obvious gains and the trade-off can be justified. For example, `i++; foo(i);` is
70+
preferable to `foo(++i);` except in conditional expressions.
71+
- Classes and methods should have the minimum visibility that they require.
72+
A method should not have `protected` visibility when being package-visible could
73+
be enough, unless subclasses in other packages would naturally extend it. For
74+
complex package-level or inner classes, it is acceptable to have `protected`
75+
methods as a mean to document which ones are intended to be overridden by other
76+
classes. (In that case, protected methods do not appear in the Javadocs and
77+
therefore are not part of the API)
78+
79+
<br/>
80+
81+
## Distribution
82+
83+
This project [is not being submitted to the Maven Central repository](https://groups.google.com/g/css4j/c/op5jIoINb3M/m/IiiN-LfkDAAJ)
84+
and this is something known to deter some contributors, thus being a relevant
85+
information to cover here.
86+
87+
However, the project distributes its artifacts through the css4j Maven
88+
repository, as explained in the [README](README.md) (see 'Usage from a Gradle
89+
project').

LICENSE.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Copyright (c) 2010 World Wide Web Consortium, (Massachusetts Institute of
2+
Technology, European Research Consortium for Informatics and Mathematics, Keio
3+
University). All Rights Reserved.
4+
5+
This work is being provided by the copyright holders under the following
6+
license:
7+
8+
9+
License
10+
=======
11+
By obtaining, using and/or copying this work, you (the licensee) agree that you
12+
have read, understood, and will comply with the following terms and conditions.
13+
14+
Permission to copy, modify, and distribute this software and its documentation,
15+
with or without modification, for any purpose and without fee or royalty is
16+
hereby granted, provided that you include the following on ALL copies of the
17+
software and documentation or portions thereof, including modifications:
18+
19+
The full text of this NOTICE in a location viewable to users of the
20+
redistributed or derivative work.
21+
22+
Any pre-existing intellectual property disclaimers, notices, or terms and
23+
conditions. If none exist, the W3C Software Short Notice should be included
24+
(hypertext is preferred, text is permitted) within the body of any
25+
redistributed or derivative code.
26+
27+
Notice of any changes or modifications to the files, including the date changes
28+
were made. (We recommend you provide URIs to the location from which the code is
29+
derived.)
30+
31+
32+
Disclaimers
33+
===========
34+
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
35+
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
36+
TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
37+
THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
38+
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
39+
40+
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
41+
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
42+
43+
The name and trademarks of copyright holders may NOT be used in advertising or
44+
publicity pertaining to the software without specific, written prior permission.
45+
Title to copyright in this software and any associated documentation will at all
46+
times remain with copyright holders.

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# CSS Object Model Java binding
2+
3+
This repository contains Java bindings of the CSS Object Model intended for use
4+
by the EchoSVG project.
5+
6+
<br/>
7+
8+
## Building from source
9+
10+
### Requirements
11+
12+
To build `cssom-api` you need the following software installed:
13+
14+
- The [Git version control system](https://git-scm.com/downloads) is required to
15+
obtain the sources. Any recent version should suffice.
16+
17+
- Java 11 or later. You can install it from your favourite package manager or by
18+
downloading from [Adoptium](https://adoptium.net/).
19+
20+
<br/>
21+
22+
### Building with Gradle
23+
24+
Execute the build script with `gradlew build` to build. For example:
25+
26+
```shell
27+
git clone https://github.com/css4j/cssom-apis.git
28+
cd cssom-apis
29+
./gradlew build
30+
```
31+
or just `gradlew build` (without the `./`) on a Windows command prompt.
32+
33+
<br/>
34+
35+
### Deploying to a Maven repository
36+
37+
Use:
38+
39+
- `gradlew publishToMavenLocal` to install both modules in your local Maven repository.
40+
41+
- `gradlew :cssom-api:publishToMavenLocal` to install the cssom-api module into your local Maven repository.
42+
43+
- `gradlew :domview-api:publishToMavenLocal` to install the domview-api module into your local Maven repository.
44+
45+
- `gradlew publish` to deploy both modules to a (generally remote) Maven repository.
46+
47+
- `gradlew :cssom-api:publish` to deploy the cssom-api module to a Maven repository.
48+
49+
- `gradlew :domview-api:publish` to deploy the domview-api module to a Maven repository.
50+
51+
Before deploying to a remote Maven repository, please read the
52+
`publishing.repositories.maven` block of
53+
[cssom-apis.java-conventions.gradle](https://github.com/css4j/cssom-apis/blob/master/buildSrc/src/main/groovy/cssom-apis.java-conventions.gradle)
54+
to learn which properties you need to set (like `mavenReleaseRepoUrl`or
55+
`mavenRepoUsername`), either at the [command line](https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties)
56+
(`-P` option) or your `GRADLE_USER_HOME/gradle.properties` file.
57+
58+
<br/>
59+
60+
## Usage from a Gradle project
61+
62+
If your Gradle project depends on any of the web-apis modules, you can use this
63+
project's own Maven repository in a `repositories` section of your build file:
64+
65+
```groovy
66+
repositories {
67+
maven {
68+
url "https://css4j.github.io/maven/"
69+
mavenContent {
70+
releasesOnly()
71+
}
72+
content {
73+
includeGroup 'io.sf.w3'
74+
}
75+
}
76+
}
77+
```
78+
Then, in your `build.gradle` file you can list the dependencies, for example:
79+
80+
```groovy
81+
dependencies {
82+
api 'io.sf.w3:cssom-api:0.1'
83+
}
84+
```
85+
86+
<br/>
87+
88+
## Licensing
89+
90+
The source files and derived works are available under the "W3C Software and
91+
Document Notice and License". Please read the [LICENSE.txt](LICENSE.txt) file
92+
for details.

buildSrc/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
// Support convention plugins written in Groovy.
3+
id 'groovy-gradle-plugin'
4+
}
5+
6+
repositories {
7+
// Use the plugin portal to apply community plugins in convention plugins.
8+
gradlePluginPortal()
9+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
*
3+
* Licensed under a BSD-style License. You can find the license here:
4+
* https://css4j.github.io/LICENSE.txt
5+
*
6+
*/
7+
/*
8+
* SPDX-License-Identifier: BSD-3-Clause
9+
*/
10+
11+
import org.gradle.api.DefaultTask
12+
import org.gradle.api.tasks.TaskAction
13+
14+
/**
15+
* Converts line endings to CRLF (Windows)
16+
* <p>
17+
* Usage:
18+
* </p>
19+
* <code>
20+
* tasks.register('lineEndingConversion', CRLFConvert) {
21+
* file "path/to/file1.txt"
22+
* file "path/to/fileN.txt"
23+
* }
24+
* </code>
25+
*/
26+
class CRLFConvert extends DefaultTask {
27+
28+
private static final String CRLF = "\r\n"
29+
private static final String LF = "\n"
30+
31+
private files = []
32+
33+
@TaskAction
34+
def action() {
35+
files.each { path ->
36+
File file = new File(path)
37+
if (file.exists()) {
38+
String content = file.text
39+
String newContent = content.replaceAll(/\r\n/, LF)
40+
newContent = newContent.replaceAll(/\n|\r/, CRLF)
41+
if (content != newContent) {
42+
file.write(newContent)
43+
}
44+
} else {
45+
logger.warn('File ' + path + ' does not exist.')
46+
}
47+
}
48+
}
49+
50+
def file(String path) {
51+
this.files << path
52+
}
53+
}

0 commit comments

Comments
 (0)