-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 92ed1ec
Showing
63 changed files
with
3,352 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
* text=auto eol=lf | ||
*.java text eol=lf | ||
*.properties text eol=lf | ||
*.css text eol=lf | ||
*.html text eol=lf | ||
*.xhtml text eol=lf | ||
*.dtd text eol=lf | ||
*.ent text eol=lf | ||
*.txt text | ||
*.bat text eol=crlf | ||
*.sh text eol=lf | ||
*.xml text eol=lf | ||
*.bin binary | ||
*.png binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Build CI workflow | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# Allows to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
name: Java build | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Set JDK | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
# Build | ||
- name: Build with Gradle | ||
run: ./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This workflow will build a package using Gradle and then deploy it to GitHub | ||
# packages when a release is published | ||
|
||
name: Github Packages | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
server-id: github | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
- name: Publish to GitHub Packages | ||
run: ./gradlew publish -PmavenReleaseRepoUrl="https://maven.pkg.github.com/css4j/cssom-apis" -PmavenRepoUsername=${{ github.actor }} -PmavenRepoPassword=${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*~ | ||
.classpath | ||
.project | ||
.settings | ||
*/bin/ | ||
**/build/ | ||
/.idea | ||
/.gradle | ||
/buildSrc/.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Contributing to CSSOM-APIs | ||
|
||
You can contribute to this project by raising issues and/or sending `git` pull | ||
requests. | ||
|
||
<br/> | ||
|
||
## Report issues | ||
|
||
If you find any issue with the software or want to ask for an enhancement, use | ||
the Github's [issue tracker](https://github.com/css4j/cssom-apis/issues). | ||
|
||
<br/> | ||
|
||
## Pull requests | ||
|
||
To contribute code to this project it is recommended to open an issue first, | ||
explaining the rationale for the changes that you want to implement. Then, in | ||
the title of the pull request (PR) you can include a reference like "fixes #NN" | ||
where NN is the issue number. And it is generally a good idea to base your PR on | ||
a branch that was named after the issue; for example your branch could be named | ||
`issue-14`. | ||
|
||
A PR should only try to fix a single issue, unless it fixes two or more issues | ||
that are very related or effectively the same. And if a commit has two or more | ||
different purposes, it is often better to split it in multiple commits; tools | ||
like the _Git GUI_ are particularly useful for that. | ||
|
||
<br/> | ||
|
||
### Commit messages | ||
|
||
It is recommended that commit messages (or at least the message for the main | ||
commit) start with a prefix related to the API being affected. For example: | ||
``` | ||
smil: change return type of function. Fixes #2. | ||
``` | ||
If the commit has a wider scope than a single area, you do not need to include | ||
any prefix, for example: | ||
``` | ||
Add .gitattributes file. | ||
``` | ||
The commit should focus on a specific task, and its descriptive message should | ||
tell accurately what the commit does. For example, do not mix bug fixes with | ||
arbitrary clean-ups, unless the clean-up is part of the fix. | ||
|
||
Although it is acceptable to include a small, unrelated code formatting fix | ||
inside a bug-fixing commit (like a small indentation fix in the same file), if | ||
the commit contains several formatting changes they should be split to a | ||
different commit. That eases the task of future code reviewers. | ||
|
||
<br/> | ||
|
||
### Code style | ||
|
||
The code style could be summarized by the following points: | ||
|
||
- Indent by tabs, not spaces. The automated formatting provided by the Eclipse | ||
IDE is often used. | ||
- Avoid trailing whitespace except for empty lines in Javadoc comments. | ||
- `if`-`else` blocks should always use curly braces, even if a single line of | ||
code is involved. | ||
- Long, descriptive variable names are preferred. | ||
- Add comments to explain what the code is trying to do, but avoiding useless | ||
prose that just mimics the code, like _"check if foo is larger than 1"_ as a | ||
comment to `if (foo > 1)`. | ||
- Public and protected methods must have documentation comments. | ||
- Code readability should not be sacrificed for compactness, unless there are | ||
obvious gains and the trade-off can be justified. For example, `i++; foo(i);` is | ||
preferable to `foo(++i);` except in conditional expressions. | ||
- Classes and methods should have the minimum visibility that they require. | ||
A method should not have `protected` visibility when being package-visible could | ||
be enough, unless subclasses in other packages would naturally extend it. For | ||
complex package-level or inner classes, it is acceptable to have `protected` | ||
methods as a mean to document which ones are intended to be overridden by other | ||
classes. (In that case, protected methods do not appear in the Javadocs and | ||
therefore are not part of the API) | ||
|
||
<br/> | ||
|
||
## Distribution | ||
|
||
This project [is not being submitted to the Maven Central repository](https://groups.google.com/g/css4j/c/op5jIoINb3M/m/IiiN-LfkDAAJ) | ||
and this is something known to deter some contributors, thus being a relevant | ||
information to cover here. | ||
|
||
However, the project distributes its artifacts through the css4j Maven | ||
repository, as explained in the [README](README.md) (see 'Usage from a Gradle | ||
project'). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Copyright (c) 2010 World Wide Web Consortium, (Massachusetts Institute of | ||
Technology, European Research Consortium for Informatics and Mathematics, Keio | ||
University). All Rights Reserved. | ||
|
||
This work is being provided by the copyright holders under the following | ||
license: | ||
|
||
|
||
License | ||
======= | ||
By obtaining, using and/or copying this work, you (the licensee) agree that you | ||
have read, understood, and will comply with the following terms and conditions. | ||
|
||
Permission to copy, modify, and distribute this software and its documentation, | ||
with or without modification, for any purpose and without fee or royalty is | ||
hereby granted, provided that you include the following on ALL copies of the | ||
software and documentation or portions thereof, including modifications: | ||
|
||
The full text of this NOTICE in a location viewable to users of the | ||
redistributed or derivative work. | ||
|
||
Any pre-existing intellectual property disclaimers, notices, or terms and | ||
conditions. If none exist, the W3C Software Short Notice should be included | ||
(hypertext is preferred, text is permitted) within the body of any | ||
redistributed or derivative code. | ||
|
||
Notice of any changes or modifications to the files, including the date changes | ||
were made. (We recommend you provide URIs to the location from which the code is | ||
derived.) | ||
|
||
|
||
Disclaimers | ||
=========== | ||
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE | ||
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT | ||
THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY | ||
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. | ||
|
||
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR | ||
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. | ||
|
||
The name and trademarks of copyright holders may NOT be used in advertising or | ||
publicity pertaining to the software without specific, written prior permission. | ||
Title to copyright in this software and any associated documentation will at all | ||
times remain with copyright holders. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# CSS Object Model Java binding | ||
|
||
This repository contains Java bindings of the CSS Object Model intended for use | ||
by the EchoSVG project. | ||
|
||
<br/> | ||
|
||
## Building from source | ||
|
||
### Requirements | ||
|
||
To build `cssom-api` you need the following software installed: | ||
|
||
- The [Git version control system](https://git-scm.com/downloads) is required to | ||
obtain the sources. Any recent version should suffice. | ||
|
||
- Java 11 or later. You can install it from your favourite package manager or by | ||
downloading from [Adoptium](https://adoptium.net/). | ||
|
||
<br/> | ||
|
||
### Building with Gradle | ||
|
||
Execute the build script with `gradlew build` to build. For example: | ||
|
||
```shell | ||
git clone https://github.com/css4j/cssom-apis.git | ||
cd cssom-apis | ||
./gradlew build | ||
``` | ||
or just `gradlew build` (without the `./`) on a Windows command prompt. | ||
|
||
<br/> | ||
|
||
### Deploying to a Maven repository | ||
|
||
Use: | ||
|
||
- `gradlew publishToMavenLocal` to install in your local Maven repository. | ||
|
||
- `gradlew publish` to deploy to a (generally remote) Maven repository. | ||
|
||
Before deploying to a remote Maven repository, please read the | ||
`publishing.repositories.maven` block of | ||
[web-apis.java-conventions.gradle](https://github.com/css4j/cssom-apis/blob/master/buildSrc/src/main/groovy/cssom-apis.java-conventions.gradle) | ||
to learn which properties you need to set (like `mavenReleaseRepoUrl`or | ||
`mavenRepoUsername`), either at the [command line](https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties) | ||
(`-P` option) or your `GRADLE_USER_HOME/gradle.properties` file. | ||
|
||
<br/> | ||
|
||
## Usage from a Gradle project | ||
|
||
If your Gradle project depends on any of the web-apis modules, you can use this | ||
project's own Maven repository in a `repositories` section of your build file: | ||
|
||
```groovy | ||
repositories { | ||
maven { | ||
url "https://css4j.github.io/maven/" | ||
mavenContent { | ||
releasesOnly() | ||
} | ||
content { | ||
includeGroup 'io.sf.w3c' | ||
} | ||
} | ||
} | ||
``` | ||
Then, in your `build.gradle` file you can list the dependencies, for example: | ||
|
||
```groovy | ||
dependencies { | ||
api 'io.sf.w3c:cssom-api:0.1' | ||
} | ||
``` | ||
|
||
<br/> | ||
|
||
## Licensing | ||
|
||
The source files and derived works are available under the "W3C Software and | ||
Document Notice and License". Please read the [LICENSE.txt](LICENSE.txt) file | ||
for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
plugins { | ||
// Support convention plugins written in Groovy. | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
// Use the plugin portal to apply community plugins in convention plugins. | ||
gradlePluginPortal() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* | ||
* Licensed under a BSD-style License. You can find the license here: | ||
* https://css4j.github.io/LICENSE.txt | ||
* | ||
*/ | ||
/* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
/** | ||
* Converts line endings to CRLF (Windows) | ||
* <p> | ||
* Usage: | ||
* </p> | ||
* <code> | ||
* tasks.register('lineEndingConversion', CRLFConvert) { | ||
* file "path/to/file1.txt" | ||
* file "path/to/fileN.txt" | ||
* } | ||
* </code> | ||
*/ | ||
class CRLFConvert extends DefaultTask { | ||
|
||
private static final String CRLF = "\r\n" | ||
private static final String LF = "\n" | ||
|
||
private files = [] | ||
|
||
@TaskAction | ||
def action() { | ||
files.each { path -> | ||
File file = new File(path) | ||
if (file.exists()) { | ||
String content = file.text | ||
String newContent = content.replaceAll(/\r\n/, LF) | ||
newContent = newContent.replaceAll(/\n|\r/, CRLF) | ||
if (content != newContent) { | ||
file.write(newContent) | ||
} | ||
} else { | ||
logger.warn('File ' + path + ' does not exist.') | ||
} | ||
} | ||
} | ||
|
||
def file(String path) { | ||
this.files << path | ||
} | ||
} |
Oops, something went wrong.